943acbc573
Durcit la convention de nommage des projets (dérive constatée : 'Sliding Automation', 'code_versioning'... au lieu des formes canoniques). - trilium_api.py : projets_canoniques() lit le référentiel = valeurs du label projet sur les notes de type=projet (source unique, pas de constante en dur). Note-projet CodeVersioning créée (manquait). - mcp_server.py : _valider_projet() branché dans les 6 tools de création (add_decision/history/backlog, new_conversation, create_entite, add_skill). Refuse un projet non canonique (suggestion si faute) ou inconnu (renvoi au processus de création de projet). Ne verrouille pas si référentiel illisible. - lint_audit.py : VAL-nommage aligné sur le référentiel (attrape casse, espace ET snake_case ; l'ancien 'contient un espace' ratait code_versioning). - Données : 79 notes ré-étiquetées vers les 3 formes canoniques. Quality by design : l'erreur de nommage devient impossible à l'écriture, le Lint n'est plus que le filet de sécurité.
56 lines
1.7 KiB
Python
56 lines
1.7 KiB
Python
# Copyright wavedrompy contributors.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
import argparse
|
|
import json
|
|
import yaml
|
|
import sys
|
|
|
|
from .waveform import WaveDrom
|
|
from .assign import Assign
|
|
from .version import version
|
|
from .bitfield import BitField
|
|
|
|
import json
|
|
|
|
|
|
def fixQuotes(inputString):
|
|
# fix double quotes in the input file. opening with yaml and dumping with json fix the issues.
|
|
yamlCode = yaml.load(inputString, Loader=yaml.FullLoader)
|
|
fixedString = json.dumps(yamlCode, indent=4)
|
|
return fixedString
|
|
|
|
|
|
def render(source="", output=[], strict_js_features = False):
|
|
source = json.loads(fixQuotes(source))
|
|
if source.get("signal"):
|
|
return WaveDrom().render_waveform(0, source, output, strict_js_features)
|
|
elif source.get("assign"):
|
|
return Assign().render(0, source, output)
|
|
elif source.get("reg"):
|
|
return BitField().renderJson(source)
|
|
|
|
|
|
def render_write(source, output, strict_js_features = False):
|
|
jinput = source.read()
|
|
out = render(jinput, strict_js_features=strict_js_features)
|
|
out.write(output)
|
|
|
|
|
|
def render_file(source, output, strict_js_features = False):
|
|
out = open(output, "w")
|
|
render_write(open(source, "r"), out, strict_js_features=strict_js_features)
|
|
out.close()
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="")
|
|
parser.add_argument("--input", "-i", help="<input wavedrom source filename>",
|
|
required=True, type=argparse.FileType('r'))
|
|
parser.add_argument("--svg", "-s", help="<output SVG image file name>",
|
|
nargs='?', type=argparse.FileType('w'), default=sys.stdout)
|
|
args = parser.parse_args()
|
|
|
|
render_write(args.input, args.svg, False)
|