ScriptCollection 4.4.73__py3-none-any.whl → 4.4.74__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ScriptCollection/ProgramRunnerPopen.py +4 -2
- ScriptCollection/ProgramRunnerSudo.py +11 -5
- ScriptCollection/ScriptCollectionCore.py +18 -6
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +158 -2
- {scriptcollection-4.4.73.dist-info → scriptcollection-4.4.74.dist-info}/METADATA +1 -1
- {scriptcollection-4.4.73.dist-info → scriptcollection-4.4.74.dist-info}/RECORD +9 -9
- {scriptcollection-4.4.73.dist-info → scriptcollection-4.4.74.dist-info}/WHEEL +0 -0
- {scriptcollection-4.4.73.dist-info → scriptcollection-4.4.74.dist-info}/entry_points.txt +0 -0
- {scriptcollection-4.4.73.dist-info → scriptcollection-4.4.74.dist-info}/top_level.txt +0 -0
|
@@ -26,10 +26,12 @@ class ProgramRunnerPopen(ProgramRunnerBase):
|
|
|
26
26
|
def run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> Popen:
|
|
27
27
|
arguments_for_process, env = self.__get_process_start_information(program, arguments_as_array, env_vars)
|
|
28
28
|
try:
|
|
29
|
+
# errors="replace": a program can write bytes which are not valid in the used encoding (for example gpgv writes a name with
|
|
30
|
+
# an umlaut in latin-1). Without replacing them, reading the output would fail at the first such byte and the output would be lost.
|
|
29
31
|
if interactive:
|
|
30
|
-
result = Popen(arguments_for_process, cwd=working_directory, stdout=PIPE, stderr=PIPE, shell=False, text=True, stdin=sys.stdin, env=env) # pylint: disable=consider-using-with
|
|
32
|
+
result = Popen(arguments_for_process, cwd=working_directory, stdout=PIPE, stderr=PIPE, shell=False, text=True, errors="replace", stdin=sys.stdin, env=env) # pylint: disable=consider-using-with
|
|
31
33
|
else:
|
|
32
|
-
result = Popen(arguments_for_process, cwd=working_directory, stdout=PIPE, stderr=PIPE, shell=False, text=True, env=env) # pylint: disable=consider-using-with
|
|
34
|
+
result = Popen(arguments_for_process, cwd=working_directory, stdout=PIPE, stderr=PIPE, shell=False, text=True, errors="replace", env=env) # pylint: disable=consider-using-with
|
|
33
35
|
except FileNotFoundError as fileNotFoundError:
|
|
34
36
|
raise FileNotFoundError(f"Starting '{program}' in '{working_directory}' resulted in a FileNotFoundError: '{str(fileNotFoundError)}'")
|
|
35
37
|
except NotADirectoryError as notADirectoryError:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import io
|
|
1
2
|
from subprocess import Popen
|
|
2
3
|
from .GeneralUtilities import GeneralUtilities
|
|
3
4
|
from .ProgramRunnerBase import ProgramRunnerBase
|
|
@@ -18,23 +19,25 @@ class SudoPopenReader:
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
class SudoPopen:
|
|
22
|
+
"""Represents an already terminated program-run with the interface of a subprocess.Popen which was created with text=True.
|
|
23
|
+
stdout and stderr are text-streams (and not bytes), because ScriptCollectionCore reads them line by line with readline until it gets an empty string."""
|
|
21
24
|
returncode: int = None
|
|
22
25
|
stdout_str: str = None
|
|
23
26
|
stderr_str: str = None
|
|
24
27
|
pid: int = None
|
|
25
|
-
stdout:
|
|
26
|
-
stderr:
|
|
28
|
+
stdout: io.StringIO = None
|
|
29
|
+
stderr: io.StringIO = None
|
|
27
30
|
|
|
28
31
|
def __init__(self, exitcode: int, stdout: str, stderr: str, pid: int):
|
|
29
32
|
self.returncode: int = exitcode
|
|
30
33
|
self.stdout_str: str = stdout
|
|
31
|
-
self.stdout =
|
|
34
|
+
self.stdout = io.StringIO(self.stdout_str)
|
|
32
35
|
self.stderr_str: str = stderr
|
|
33
|
-
self.stderr =
|
|
36
|
+
self.stderr = io.StringIO(self.stderr_str)
|
|
34
37
|
self.pid = pid
|
|
35
38
|
|
|
36
39
|
def communicate(self):
|
|
37
|
-
return (self.
|
|
40
|
+
return (self.stdout_str, self.stderr_str)
|
|
38
41
|
|
|
39
42
|
def wait(self):
|
|
40
43
|
return self.returncode
|
|
@@ -42,6 +45,9 @@ class SudoPopen:
|
|
|
42
45
|
def poll(self) -> object:
|
|
43
46
|
return self.returncode
|
|
44
47
|
|
|
48
|
+
def kill(self) -> None:
|
|
49
|
+
pass # the program-run is already terminated when this object is created, so there is nothing to kill.
|
|
50
|
+
|
|
45
51
|
def __enter__(self):
|
|
46
52
|
return self
|
|
47
53
|
|
|
@@ -41,7 +41,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
|
41
41
|
from .ProgramRunnerPopen import ProgramRunnerPopen
|
|
42
42
|
from .SCLog import SCLog, LogLevel
|
|
43
43
|
|
|
44
|
-
version = "4.4.
|
|
44
|
+
version = "4.4.74"
|
|
45
45
|
__version__ = version
|
|
46
46
|
|
|
47
47
|
class VSCodeWorkspaceShellTask:
|
|
@@ -1521,13 +1521,13 @@ class ScriptCollectionCore:
|
|
|
1521
1521
|
arguments = arguments+["--excludedirectories"]
|
|
1522
1522
|
if printonlynamewithoutpath:
|
|
1523
1523
|
arguments = arguments+["--printonlynamewithoutpath"]
|
|
1524
|
-
exit_code, stdout, stderr, _ = self.run_program_argsasarray("sclistfoldercontent", arguments)
|
|
1524
|
+
exit_code, stdout, stderr, _ = self.run_program_argsasarray("sclistfoldercontent", arguments, throw_exception_if_exitcode_is_not_zero=False)
|
|
1525
1525
|
if exit_code == 0:
|
|
1526
1526
|
for line in stdout.split("\n"):
|
|
1527
1527
|
normalized_line = line.replace("\r", "")
|
|
1528
1528
|
result.append(normalized_line)
|
|
1529
1529
|
else:
|
|
1530
|
-
raise ValueError(f"Fatal error occurred while
|
|
1530
|
+
raise ValueError(f"Fatal error occurred while listing the content of folder '{path}'. Exitcode: {exit_code}, StdErr: '{stderr}'")
|
|
1531
1531
|
result = [item for item in result if GeneralUtilities.string_has_nonwhitespace_content(item)]
|
|
1532
1532
|
return result
|
|
1533
1533
|
|
|
@@ -2626,9 +2626,21 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
|
|
|
2626
2626
|
ScriptCollectionCore.__process_stdout_lines(q_stdout, stdout_result, print_live_output, log)
|
|
2627
2627
|
ScriptCollectionCore.__process_stderr_lines(q_stderr, stderr_result, print_live_output, print_errors_as_information, log)
|
|
2628
2628
|
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2629
|
+
# Leaving the with-block waits until both reader-threads are terminated, so their result is final here.
|
|
2630
|
+
if timed_out:
|
|
2631
|
+
raise TimeoutError(f"The process with process-id {p_id} did not finish within the configured timeout of {timeoutInSeconds} second(s) and was killed.")
|
|
2632
|
+
ScriptCollectionCore.__raise_if_reading_failed(readers, p_id)
|
|
2633
|
+
return (stdout_result, stderr_result)
|
|
2634
|
+
|
|
2635
|
+
@staticmethod
|
|
2636
|
+
def __raise_if_reading_failed(readers: list, p_id: int) -> None:
|
|
2637
|
+
"""Raises the error of a reader-thread which failed.
|
|
2638
|
+
Without this check such an error (for example a program-runner whose popen-object does not provide readable text-streams)
|
|
2639
|
+
would be swallowed by the thread-pool, so that the program-run would look like a successful run without any output."""
|
|
2640
|
+
for reader in readers:
|
|
2641
|
+
reader_error: BaseException = reader.exception()
|
|
2642
|
+
if reader_error is not None:
|
|
2643
|
+
raise ValueError(f"Reading the output of the process with process-id {p_id} failed.") from reader_error
|
|
2632
2644
|
|
|
2633
2645
|
@GeneralUtilities.check_arguments
|
|
2634
2646
|
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, print_errors_as_information: bool = False, log_file: str = None, timeoutInSeconds: int = None, addLogOverhead: bool = False, title: str = None, log_namespace: str = "", arguments_for_log: list[str] = None, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False, print_live_output: bool = False, env_vars: dict = None) -> tuple[int, str, str, int]:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import base64
|
|
1
2
|
import os
|
|
2
3
|
import json
|
|
3
4
|
import re
|
|
4
5
|
import shutil
|
|
5
6
|
import tempfile
|
|
6
7
|
from datetime import datetime, timedelta,timezone
|
|
8
|
+
import requests
|
|
7
9
|
import xmlschema
|
|
8
10
|
from packaging.version import Version
|
|
9
11
|
from ..GeneralUtilities import GeneralUtilities
|
|
@@ -76,6 +78,8 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
76
78
|
__assert_no_new_changes:bool = None
|
|
77
79
|
__add_ready_to_merge_flag:bool = None
|
|
78
80
|
__fast_lane:bool = None
|
|
81
|
+
# The tools for which openspec is initialized in a repository which uses openspec but in which openspec is not initialized yet.
|
|
82
|
+
__openspec_tools:list[str] = ["claude", "cline", "github-copilot", "vibe", "opencode", "codex", "gemini", "cursor"]
|
|
79
83
|
|
|
80
84
|
def __init__(self,repository:str,loglevel:LogLevel,target_environment_type:str,additionalargumentsfile:str,use_cache:bool,is_pre_merge:bool,assertnonewchanges:bool,add_ready_to_merge_flag:bool=False,fast_lane:bool=False):
|
|
81
85
|
self.sc=ScriptCollectionCore()
|
|
@@ -287,12 +291,145 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
287
291
|
if updated_lines != lines:
|
|
288
292
|
GeneralUtilities.write_lines_to_file(agent_sandbox_configuration_file, updated_lines)
|
|
289
293
|
|
|
294
|
+
@GeneralUtilities.check_arguments
|
|
295
|
+
def __check_security_txt_file(self, repository_folder: str) -> None:
|
|
296
|
+
"""Checks the file '<repository>/.well-known/security.txt' (see RFC 9116). Every failed check is only reported as warning and does
|
|
297
|
+
not let the build fail. The URLs of the file are only checked if an internet-connection is available."""
|
|
298
|
+
security_txt_file: str = os.path.join(repository_folder, ".well-known", "security.txt")
|
|
299
|
+
if not os.path.isfile(security_txt_file):
|
|
300
|
+
self.sc.log.log(f"The file '{security_txt_file}' does not exist.", LogLevel.Warning)
|
|
301
|
+
return
|
|
302
|
+
self.sc.log.log("Check security.txt-file...", LogLevel.Debug)
|
|
303
|
+
fields: dict[str, list[str]] = TFCPS_CodeUnit_BuildCodeUnits.__get_security_txt_fields(security_txt_file)
|
|
304
|
+
internet_connection_is_available: bool = GeneralUtilities.internet_connection_is_available()
|
|
305
|
+
self.__check_security_txt_signature(security_txt_file, fields, internet_connection_is_available)
|
|
306
|
+
self.__check_security_txt_expiration(security_txt_file, fields, GeneralUtilities.get_now())
|
|
307
|
+
if internet_connection_is_available:
|
|
308
|
+
self.__check_security_txt_urls_are_reachable(security_txt_file, fields, "Canonical")
|
|
309
|
+
self.__check_security_txt_urls_are_reachable(security_txt_file, fields, "Encryption")
|
|
310
|
+
else:
|
|
311
|
+
self.sc.log.log(f"The URLs of '{security_txt_file}' are not checked because no internet-connection is available.", LogLevel.Debug)
|
|
312
|
+
|
|
313
|
+
@staticmethod
|
|
314
|
+
@GeneralUtilities.check_arguments
|
|
315
|
+
def __get_security_txt_fields(security_txt_file: str) -> dict[str, list[str]]:
|
|
316
|
+
"""Returns the values of the fields of the given security.txt-file, grouped by the lowercase field-name (field-names are
|
|
317
|
+
case-insensitive according to RFC 9116). A field can occur multiple times, so every field-name maps to a list of values.
|
|
318
|
+
Comments and the lines of the PGP-envelope are ignored."""
|
|
319
|
+
result: dict[str, list[str]] = {}
|
|
320
|
+
for line in GeneralUtilities.read_lines_from_file(security_txt_file):
|
|
321
|
+
match = re.match(r"^([A-Za-z0-9-]+):\s*(.*?)\s*$", line)
|
|
322
|
+
if match is not None:
|
|
323
|
+
result.setdefault(match.group(1).lower(), []).append(match.group(2))
|
|
324
|
+
return result
|
|
325
|
+
|
|
326
|
+
@GeneralUtilities.check_arguments
|
|
327
|
+
def __check_security_txt_signature(self, security_txt_file: str, fields: dict[str, list[str]], internet_connection_is_available: bool) -> None:
|
|
328
|
+
"""Checks whether the given security.txt-file has a PGP-signature and whether it is valid.
|
|
329
|
+
Only the validity of the signature is checked and not whether the key of the signer is trusted. Therefore the signature is
|
|
330
|
+
verified with gpgv against a temporary keyring which only contains the public key which is downloaded from the first
|
|
331
|
+
http(s)-URL of the 'Encryption'-field. This way the result does not depend on the keyring of the current user, so the check
|
|
332
|
+
works the same way in a build-pipeline. Without internet-connection the public key can not be downloaded, so the signature
|
|
333
|
+
can not be verified then."""
|
|
334
|
+
if "-----BEGIN PGP SIGNED MESSAGE-----" not in GeneralUtilities.read_text_from_file(security_txt_file):
|
|
335
|
+
self.sc.log.log(f"The file '{security_txt_file}' is not signed.", LogLevel.Warning)
|
|
336
|
+
return
|
|
337
|
+
if not GeneralUtilities.tool_is_available("gpgv"):
|
|
338
|
+
self.sc.log.log(f"The signature of '{security_txt_file}' can not be verified because gpgv is not available.", LogLevel.Warning)
|
|
339
|
+
return
|
|
340
|
+
if not internet_connection_is_available:
|
|
341
|
+
self.sc.log.log(f"The signature of '{security_txt_file}' can not be verified because the public key can not be downloaded without internet-connection.", LogLevel.Warning)
|
|
342
|
+
return
|
|
343
|
+
key_urls: list[str] = [url for url in fields.get("encryption", []) if url.lower().startswith(("https://", "http://"))]
|
|
344
|
+
if len(key_urls) == 0:
|
|
345
|
+
self.sc.log.log(f"The signature of '{security_txt_file}' can not be verified because the file does not contain an 'Encryption'-field with an http(s)-URL of the public key.", LogLevel.Warning)
|
|
346
|
+
return
|
|
347
|
+
key_url: str = key_urls[0]
|
|
348
|
+
try:
|
|
349
|
+
response = requests.get(key_url, timeout=30, allow_redirects=True)
|
|
350
|
+
except requests.RequestException as exception:
|
|
351
|
+
self.sc.log.log(f"The signature of '{security_txt_file}' can not be verified because the public key can not be downloaded from '{key_url}': {exception}", LogLevel.Warning)
|
|
352
|
+
return
|
|
353
|
+
if not response.ok:
|
|
354
|
+
self.sc.log.log(f"The signature of '{security_txt_file}' can not be verified because the public key can not be downloaded from '{key_url}' (HTTP-status {response.status_code}).", LogLevel.Warning)
|
|
355
|
+
return
|
|
356
|
+
public_key: bytes = TFCPS_CodeUnit_BuildCodeUnits.__dearmor_pgp_public_key(response.text)
|
|
357
|
+
if public_key is None:
|
|
358
|
+
self.sc.log.log(f"The signature of '{security_txt_file}' can not be verified because '{key_url}' does not contain a PGP-public-key-block.", LogLevel.Warning)
|
|
359
|
+
return
|
|
360
|
+
with tempfile.TemporaryDirectory() as keyring_folder:
|
|
361
|
+
keyring_file: str = os.path.join(keyring_folder, "PublicKey.gpg")
|
|
362
|
+
with open(keyring_file, "wb") as keyring_file_stream:
|
|
363
|
+
keyring_file_stream.write(public_key)
|
|
364
|
+
# The keyring-file is passed as path relative to the working-directory with a leading "./": gpgv searches a path without
|
|
365
|
+
# a slash in its home-folder, and the gpgv of git-for-windows does not accept an absolute windows-path as keyring.
|
|
366
|
+
exit_code, _, stderr, _ = self.sc.run_program_argsasarray("gpgv", ["--keyring", f"./{os.path.basename(keyring_file)}", os.path.abspath(security_txt_file)], keyring_folder, throw_exception_if_exitcode_is_not_zero=False)
|
|
367
|
+
if exit_code != 0:
|
|
368
|
+
self.sc.log.log(f"The signature of '{security_txt_file}' is not valid for the public key from '{key_url}' (exitcode of gpgv: {exit_code}). StdErr: '{stderr}'", LogLevel.Warning)
|
|
369
|
+
|
|
370
|
+
@staticmethod
|
|
371
|
+
@GeneralUtilities.check_arguments
|
|
372
|
+
def __dearmor_pgp_public_key(armored_content: str) -> bytes:
|
|
373
|
+
"""Returns the binary content of the first ASCII-armored PGP-public-key-block of the given content (the format which gpgv
|
|
374
|
+
expects for a keyring-file), or None if the content does not contain such a block. The armor-headers (for example 'Comment:')
|
|
375
|
+
and the checksum-line (which starts with '=') are not part of the binary content."""
|
|
376
|
+
match = re.search(r"-----BEGIN PGP PUBLIC KEY BLOCK-----\r?\n(.*?)-----END PGP PUBLIC KEY BLOCK-----", armored_content, re.DOTALL)
|
|
377
|
+
if match is None:
|
|
378
|
+
return None
|
|
379
|
+
lines: list[str] = [line.strip() for line in match.group(1).splitlines()]
|
|
380
|
+
if GeneralUtilities.empty_string in lines:
|
|
381
|
+
lines = lines[lines.index(GeneralUtilities.empty_string)+1:] # the armor-headers end with the first empty line
|
|
382
|
+
return base64.b64decode("".join(line for line in lines if GeneralUtilities.string_has_content(line) and not line.startswith("=")))
|
|
383
|
+
|
|
384
|
+
@GeneralUtilities.check_arguments
|
|
385
|
+
def __check_security_txt_expiration(self, security_txt_file: str, fields: dict[str, list[str]], now: datetime) -> None:
|
|
386
|
+
"""Checks whether the given security.txt-file contains exactly one 'Expires'-field (RFC 9116 does not allow more than one) whose
|
|
387
|
+
value is not expired and which is valid for at least the next 3 months. A value without timezone is treated as UTC."""
|
|
388
|
+
expires_values: list[str] = fields.get("expires", [])
|
|
389
|
+
if len(expires_values) == 0:
|
|
390
|
+
self.sc.log.log(f"The file '{security_txt_file}' does not contain an 'Expires'-field.", LogLevel.Warning)
|
|
391
|
+
return
|
|
392
|
+
if 1 < len(expires_values):
|
|
393
|
+
self.sc.log.log(f"The file '{security_txt_file}' contains more than one 'Expires'-field.", LogLevel.Warning)
|
|
394
|
+
return
|
|
395
|
+
try:
|
|
396
|
+
expires: datetime = datetime.fromisoformat(expires_values[0])
|
|
397
|
+
except ValueError:
|
|
398
|
+
self.sc.log.log(f"The 'Expires'-value '{expires_values[0]}' of '{security_txt_file}' is not a valid timestamp.", LogLevel.Warning)
|
|
399
|
+
return
|
|
400
|
+
if expires.tzinfo is None:
|
|
401
|
+
expires = expires.replace(tzinfo=timezone.utc)
|
|
402
|
+
if expires <= now:
|
|
403
|
+
self.sc.log.log(f"The file '{security_txt_file}' is expired since {expires_values[0]}.", LogLevel.Warning)
|
|
404
|
+
elif expires - now < timedelta(days=30*3):
|
|
405
|
+
self.sc.log.log(f"The file '{security_txt_file}' expires within the next 3 months ({expires_values[0]}).", LogLevel.Warning)
|
|
406
|
+
|
|
407
|
+
@GeneralUtilities.check_arguments
|
|
408
|
+
def __check_security_txt_urls_are_reachable(self, security_txt_file: str, fields: dict[str, list[str]], field_name: str) -> None:
|
|
409
|
+
"""Checks whether the URLs of the given field of the given security.txt-file are reachable. Values which are no http(s)-URL (for
|
|
410
|
+
example an 'openpgp4fpr:'-URI in the 'Encryption'-field) can not be requested and are therefore not checked."""
|
|
411
|
+
urls: list[str] = fields.get(field_name.lower(), [])
|
|
412
|
+
if len(urls) == 0:
|
|
413
|
+
self.sc.log.log(f"The file '{security_txt_file}' does not contain a '{field_name}'-field.", LogLevel.Warning)
|
|
414
|
+
return
|
|
415
|
+
for url in urls:
|
|
416
|
+
if not url.lower().startswith(("https://", "http://")):
|
|
417
|
+
self.sc.log.log(f"The {field_name}-value '{url}' of '{security_txt_file}' is not checked because it is not an http(s)-URL.", LogLevel.Debug)
|
|
418
|
+
continue
|
|
419
|
+
try:
|
|
420
|
+
with requests.get(url, timeout=30, stream=True, allow_redirects=True) as response:
|
|
421
|
+
if not response.ok:
|
|
422
|
+
self.sc.log.log(f"The {field_name}-URL '{url}' of '{security_txt_file}' is not reachable (HTTP-status {response.status_code}).", LogLevel.Warning)
|
|
423
|
+
except requests.RequestException as exception:
|
|
424
|
+
self.sc.log.log(f"The {field_name}-URL '{url}' of '{security_txt_file}' is not reachable: {exception}", LogLevel.Warning)
|
|
425
|
+
|
|
290
426
|
@GeneralUtilities.check_arguments
|
|
291
427
|
def __do_project_linting(self, repository_folder: str) -> None:
|
|
292
428
|
self.sc.log.log("Do project-linting...")
|
|
293
|
-
self.
|
|
429
|
+
self.__run_codespell(repository_folder)
|
|
294
430
|
self.__sort_findings(repository_folder)
|
|
295
431
|
self.__validate_openspec(repository_folder)
|
|
432
|
+
self.__check_security_txt_file(repository_folder)
|
|
296
433
|
|
|
297
434
|
@GeneralUtilities.check_arguments
|
|
298
435
|
def __sort_findings(self, repository_folder: str) -> None:
|
|
@@ -300,7 +437,7 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
300
437
|
TFCPS_FindingsSorter().sort_findings(repository_folder)
|
|
301
438
|
|
|
302
439
|
@GeneralUtilities.check_arguments
|
|
303
|
-
def
|
|
440
|
+
def __run_codespell(self, repository_folder: str) -> None:
|
|
304
441
|
"""Searches for typos in the repository using codespell. Findings are only reported as warnings and do not let the build fail.
|
|
305
442
|
Only files which are not git-ignored are checked. See TFCPS_CodeSpellCheck for details."""
|
|
306
443
|
try:
|
|
@@ -439,10 +576,29 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
439
576
|
def __update_openspec(self) -> None:
|
|
440
577
|
openspec_configuration_file: str = os.path.join(self.repository, "openspec", "config.yaml")
|
|
441
578
|
if os.path.isfile(openspec_configuration_file):
|
|
579
|
+
if not self.__openspec_is_initialized():
|
|
580
|
+
#"openspec update" only updates the tools which are already set up in the repository, so a repository which only contains
|
|
581
|
+
#"openspec/config.yaml" would never get any openspec-skill without this initialization. "openspec init" keeps an existing config.yaml.
|
|
582
|
+
self.sc.log.log("Initialize openspec...")
|
|
583
|
+
self.sc.run_with_epew("openspec", f"init --tools {','.join(TFCPS_CodeUnit_BuildCodeUnits.__openspec_tools)} --force", self.repository)
|
|
442
584
|
self.sc.log.log("Update openspec-instruction-files...")
|
|
443
585
|
self.sc.run_with_epew("openspec", "update --force", self.repository)
|
|
444
586
|
self.__replace_openspec_skill_links_by_copies()
|
|
445
587
|
|
|
588
|
+
@GeneralUtilities.check_arguments
|
|
589
|
+
def __openspec_is_initialized(self) -> bool:
|
|
590
|
+
"""Returns whether openspec has already deployed a skill in the repository. openspec (since v2.0.0) deploys its skills to
|
|
591
|
+
'.agents/skills', older versions deployed them to the skill-folders of the tools (for example '.claude/skills'). These folders are
|
|
592
|
+
located in folders in the root of the repository whose names start with a dot. The names of the skills which openspec deploys
|
|
593
|
+
start with 'openspec-'."""
|
|
594
|
+
for name in os.listdir(self.repository):
|
|
595
|
+
skills_folder: str = os.path.join(self.repository, name, "skills")
|
|
596
|
+
if name.startswith(".") and name != ".git" and os.path.isdir(skills_folder):
|
|
597
|
+
for skill_name in os.listdir(skills_folder):
|
|
598
|
+
if skill_name.startswith("openspec-") and os.path.isfile(os.path.join(skills_folder, skill_name, "SKILL.md")):
|
|
599
|
+
return True
|
|
600
|
+
return False
|
|
601
|
+
|
|
446
602
|
@GeneralUtilities.check_arguments
|
|
447
603
|
def __replace_openspec_skill_links_by_copies(self) -> None:
|
|
448
604
|
"""openspec (since v2.0.0) writes its skills to '.agents/skills' and links them into the skill-folders of the configured tools
|
|
@@ -7,12 +7,12 @@ ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xg
|
|
|
7
7
|
ScriptCollection/ProcessesRunner.py,sha256=wtNFdmj9klETTIDUSE90vaR5ClEX4V7dgJNVbp9_wi0,1381
|
|
8
8
|
ScriptCollection/ProgramRunnerBase.py,sha256=eZenpiIFW1dhvSVCG7cfBs5hO4_KLlOxR7oXoSxUDmk,2286
|
|
9
9
|
ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrRjAPIwT5Y,37
|
|
10
|
-
ScriptCollection/ProgramRunnerPopen.py,sha256=
|
|
11
|
-
ScriptCollection/ProgramRunnerSudo.py,sha256=
|
|
10
|
+
ScriptCollection/ProgramRunnerPopen.py,sha256=ctDT_FDN1v5QVnTkGbBSXD1meAD7tw6stUenxcQOvhM,6813
|
|
11
|
+
ScriptCollection/ProgramRunnerSudo.py,sha256=gTcLNt4TAUck-i9TvLHaOHYfB0TLKLVKlYNzTNJJ_6M,5575
|
|
12
12
|
ScriptCollection/RepositoryDiagramGenerator.py,sha256=K_u2NW_p4ozdWD50irJEkkcDVa70TcUJpZN63TeXSLw,7092
|
|
13
13
|
ScriptCollection/RepositoryHistoryAnalyzer.py,sha256=u9141B9D-Kef-9uo3yR7BXKUMzIKLVsesnYk7H-cWm4,6157
|
|
14
14
|
ScriptCollection/SCLog.py,sha256=Fjf8Pdi63cXHGMxL_aI6A0dwGm7QIfrv3czjvpSUlaM,4705
|
|
15
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
15
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=YU-rApqYlm8uY5jB6cHqmNuEDtXxlttSjnU9s0M3CZU,313309
|
|
16
16
|
ScriptCollection/TestKind.py,sha256=jqLJwNvQeyea7SZf-UFzMC9pM0znv4do7FIC1xq8u9M,1672
|
|
17
17
|
ScriptCollection/UnassignedVariablesCheck.py,sha256=8xNcp1D5HeOLO1a1NEerq2TsnpFhw7yzYPkaay-oisY,3804
|
|
18
18
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -73,7 +73,7 @@ ScriptCollection/TFCPS/TFCPS_BuildCodeUnitsHook.py,sha256=67_DQwoH5bhxxSmwtuAeoW
|
|
|
73
73
|
ScriptCollection/TFCPS/TFCPS_CodeSpellCheck.py,sha256=zV62O7UiGjewx1yQUIWmUJ9D-5ipkV_f28uNhp-JWUs,5306
|
|
74
74
|
ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=QvDcicWpcF9u5dKQ2uhE8yi7pfa2sn_2241hRXsZPoo,40878
|
|
75
75
|
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=_wTwaf-lmz8MijRhaM6NvNV7bI52Tlnxb8wLZnD5vcY,10678
|
|
76
|
-
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=
|
|
76
|
+
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=K00w4MO_gdw0GL-397LJjJB1rSQBkFuIkWglvUOjJqk,74283
|
|
77
77
|
ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=BVK3fpEyjcXYVHIb6YYLH7bWe6iKRaCtPrJ3tXAemYw,6582
|
|
78
78
|
ScriptCollection/TFCPS/TFCPS_FindingsSorter.py,sha256=3ChuKf-Myr3sBtQhYGw6dHlk93HO6PAH-Jq1oPYdW1s,4804
|
|
79
79
|
ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=mRBcf7XuNWOSXbZYc3NuJow18AMZ30D6Z-BtyNYfNcM,2072
|
|
@@ -112,8 +112,8 @@ ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=ZfOiefD5RGOcaZ
|
|
|
112
112
|
ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
113
113
|
ScriptCollection/TFCPS/TypeScript/TFCPS_CodeUnitSpecific_TypeScript.py,sha256=ILVhJHvwG5TvPBBqSvyACYb7W9QnWrJpxKgHu8IQu4g,9249
|
|
114
114
|
ScriptCollection/TFCPS/TypeScript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
115
|
-
scriptcollection-4.4.
|
|
116
|
-
scriptcollection-4.4.
|
|
117
|
-
scriptcollection-4.4.
|
|
118
|
-
scriptcollection-4.4.
|
|
119
|
-
scriptcollection-4.4.
|
|
115
|
+
scriptcollection-4.4.74.dist-info/METADATA,sha256=2unXONHqKGlOKx6veeEo9utQH8GBCxRV2AsgNstq_68,8037
|
|
116
|
+
scriptcollection-4.4.74.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
117
|
+
scriptcollection-4.4.74.dist-info/entry_points.txt,sha256=OK3miTYUhXpsvY3SC9pkczbh_MULzFdYUGm_qlAHRtM,6468
|
|
118
|
+
scriptcollection-4.4.74.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
119
|
+
scriptcollection-4.4.74.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|