[Tool] Create tools to save/update/delete SDC components
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3556021. -->
Reported by: [marcus_johansson](https://www.drupal.org/user/385947)
Related to !57
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Create the following tools:</p>
<p><strong>write_sdc_definition</strong><br>
This writes the definition file (.yml) of the component. It has to validate for allowed component name, if the theme or module exists and that the definition is valid. Create the component folder if it doesn't exist. Flush component cache after running.</p>
<p>inputs:<br>
* component_name - the data name of the component<br>
* theme or module - the theme or module where the sdc definition should be added/updated.<br>
* definition - the yaml as a string</p>
<p><strong>write_sdc_twig</strong><br>
This writes the twig file of the component. It has to validate for allowed component name, if the theme or module exists and that the twig is valid. Create the component folder if it doesn't exist. Flush component cache after running.</p>
<p>inputs:<br>
* component_name - the data name of the component<br>
* theme or module - the theme or module where the sdc definition should be added/updated.<br>
* definition - the twig as a string</p>
<p><strong>write_sdc_file</strong><br>
This writes a css, js or some other files in the component. It has to validate for allowed component name, if the theme or module exists and if the file type is allowed (css, js?)</p>
<p>inputs:<br>
* component_name - the data name of the component<br>
* theme or module - the theme or module where the sdc definition should be added/updated.<br>
* subdirectory - if a sub directory needs to be generated, or if it can stored as is - empty is root.<br>
* file_name - the file name to store this as.<br>
* content - the file content to save.</p>
<p><strong>copy_sdc_file</strong><br>
This copies a css, js, image, fonts from some url or uri in the component. It has to validate for allowed component name, if the theme or module exists and if the file type is allowed (css, js, images, fonts?)</p>
<p>inputs:<br>
* component_name - the data name of the component<br>
* theme or module - the theme or module where the sdc definition should be added/updated.<br>
* subdirectory - if a sub directory needs to be generated, or if it can stored as is - empty is root.<br>
* file_name - the file name to store this as.<br>
* url or uri - the file to get.</p>
<p><strong>list_component_files</strong><br>
This lists all the file in a components.</p>
<p>inputs:<br>
* component_name - the data name of the component<br>
* theme or module - the theme or module where the sdc definition should be added/updated.</p>
<p><strong>read_component_file</strong><br>
This can read a specific component file. Should validate that you can only read, css, js, twig and yaml.</p>
<p>inputs:<br>
* component_name - the data name of the component<br>
* theme or module - the theme or module where the sdc definition should be added/updated.<br>
* file path - the director and filename</p>
<p><strong>delete_component_file</strong><br>
This can delete any file that is not a twig and yml (component should be manually deleted).</p>
<p>inputs:<br>
* component_name - the data name of the component<br>
* theme or module - the theme or module where the sdc definition should be added/updated.<br>
* file path - the director and filename</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Create the tools and see if you can create a simple hero component from them.</p>
issue