Self answering.
Etymologically, the word ShAstra seems to be derived from the root word "ShAsana" meaning "to rule". So, "that which rules" is ShAstra. Also the "Tra" is derived from the word "TrAna" which means " to protect". So. "That which rules and at the same time protect" is ShAstra.
It rules by the fear of punishment (like-if you do this, this is the sort of punishment that you will get). And, it protects us from all demerits by giving us the knowledge which help us differentiating righteous conduct from unrighteous one.
In the last chapter of the KulArnava Tantram, Mother Goddess asks Lord Shiva to clarify the Artha BhAvana-s ( description of meanings) of various terminologies which are widely used in Tantra and in particular the ones that are used in the text itself.
For the word ShAstra, Lord Shiva gives the following Nirukti:
ShAsanAdanisham devi varnAshramanivAsinAm |
TAranAt sarva
pApebhyoh ShAstra mityabhidhiyate ||
..............
O Devi! Because it constantly rules (ShAsana) all dwellers of all the
orders of life, and because it protects (TArana or TrAna) from all
kinds of demerits, it is called ShAstra.
KulArnava Tantram 17.40.
The Sri VidyA AchArya BhAshkara RAya, while commenting on NityAshodashikArnava Tantram 1.14-22, in his treatise "Setubandha", also says " that which rules is ShAstra".
And, as a definition of ShAstra, he produces the following verse:
PravirtirvA nivritirvA nityena kritakena vA |
PumsAm
yenopadishyeta tat shAstram bhidhiyate ||
.............
The eternal ( or Nitya; referring to the Vedas) and the created (or Kritakena;
referring to the Smritis and other such texts) [works or texts] that
instruct men into the paths of Nivrirti and Pravirti are ShAstra-s.
He further adds that, since Tantras are orders of God himself ( he uses- SAkshAt Bhagavada AjnA), Tantras's ShAstra-hood is already established.
I am not sure though from where he is quoting that verse because nothing is mentioned.