systemlink-cli 1.13.1__tar.gz → 1.13.3__tar.gz

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.
Files changed (90) hide show
  1. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/PKG-INFO +1 -1
  2. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/pyproject.toml +1 -1
  3. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/_version.py +1 -1
  4. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/config_click.py +113 -62
  5. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/LICENSE +0 -0
  6. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/dff-editor/editor.js +0 -0
  7. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/dff-editor/index.html +0 -0
  8. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/__init__.py +0 -0
  9. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/__main__.py +0 -0
  10. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/asset_click.py +0 -0
  11. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/cli_formatters.py +0 -0
  12. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/cli_utils.py +0 -0
  13. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/comment_click.py +0 -0
  14. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/completion_click.py +0 -0
  15. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/config.py +0 -0
  16. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/dataframe_click.py +0 -0
  17. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/dff_click.py +0 -0
  18. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/dff_decorators.py +0 -0
  19. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/example_click.py +0 -0
  20. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/example_loader.py +0 -0
  21. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/example_provisioner.py +0 -0
  22. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/README.md +0 -0
  23. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/_schema/schema-v1.0.json +0 -0
  24. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/demo-complete-workflow/README.md +0 -0
  25. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/demo-complete-workflow/config.yaml +0 -0
  26. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/demo-test-plans/README.md +0 -0
  27. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/demo-test-plans/config.yaml +0 -0
  28. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/exercise-5-1-parametric-insights/README.md +0 -0
  29. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/exercise-5-1-parametric-insights/config.yaml +0 -0
  30. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/exercise-7-1-test-plans/README.md +0 -0
  31. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/exercise-7-1-test-plans/config.yaml +0 -0
  32. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/spec-compliance-notebooks/README.md +0 -0
  33. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/spec-compliance-notebooks/config.yaml +0 -0
  34. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/spec-compliance-notebooks/notebooks/SpecAnalysis_ComplianceCalculation.ipynb +0 -0
  35. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/spec-compliance-notebooks/notebooks/SpecComplianceCalculation.ipynb +0 -0
  36. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/spec-compliance-notebooks/notebooks/SpecfileExtractionAndIngestion.ipynb +0 -0
  37. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/examples/spec-compliance-notebooks/spec_template.xlsx +0 -0
  38. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/feed_click.py +0 -0
  39. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/file_click.py +0 -0
  40. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/function_click.py +0 -0
  41. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/function_templates.py +0 -0
  42. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/main.py +0 -0
  43. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/mcp_click.py +0 -0
  44. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/mcp_reachability.py +0 -0
  45. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/mcp_server.py +0 -0
  46. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/notebook_click.py +0 -0
  47. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/platform.py +0 -0
  48. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/policy_click.py +0 -0
  49. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/policy_utils.py +0 -0
  50. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/profiles.py +0 -0
  51. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/response_handlers.py +0 -0
  52. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/rich_output.py +0 -0
  53. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/routine_click.py +0 -0
  54. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skill_click.py +0 -0
  55. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/nipkg-file-package/SKILL.md +0 -0
  56. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/slcli/SKILL.md +0 -0
  57. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/slcli/references/analysis-recipes.md +0 -0
  58. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/slcli/references/commands.md +0 -0
  59. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/slcli/references/datasheet-workflow.md +0 -0
  60. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/slcli/references/filtering.md +0 -0
  61. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/slcli/references/troubleshooting.md +0 -0
  62. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-job-debugging/SKILL.md +0 -0
  63. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-notebook/SKILL.md +0 -0
  64. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-notebook/references/interfaces.md +0 -0
  65. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-notebook/references/notebook-patterns.md +0 -0
  66. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-python-test/SKILL.md +0 -0
  67. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-webapp/SKILL.md +0 -0
  68. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-webapp/references/deployment.md +0 -0
  69. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-webapp/references/layout-patterns.md +0 -0
  70. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-webapp/references/nimble-angular.md +0 -0
  71. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/skills/systemlink-webapp/references/systemlink-services.md +0 -0
  72. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/spec_click.py +0 -0
  73. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/ssl_trust.py +0 -0
  74. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/state_click.py +0 -0
  75. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/system_click.py +0 -0
  76. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/system_query_utils.py +0 -0
  77. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/table_utils.py +0 -0
  78. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/tag_click.py +0 -0
  79. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/templates_click.py +0 -0
  80. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/testmonitor_click.py +0 -0
  81. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/universal_handlers.py +0 -0
  82. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/user_click.py +0 -0
  83. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/utils.py +0 -0
  84. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/web_editor.py +0 -0
  85. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/webapp_click.py +0 -0
  86. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/workflow_preview.py +0 -0
  87. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/workflows_click.py +0 -0
  88. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/workitem_click.py +0 -0
  89. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/workspace_click.py +0 -0
  90. {systemlink_cli-1.13.1 → systemlink_cli-1.13.3}/slcli/workspace_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: systemlink-cli
3
- Version: 1.13.1
3
+ Version: 1.13.3
4
4
  Summary: SystemLink Integrator CLI - cross-platform CLI for SystemLink workflows and templates.
5
5
  License-File: LICENSE
6
6
  Author: Fred Visser
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "systemlink-cli"
3
- version = "1.13.1"
3
+ version = "1.13.3"
4
4
  description = "SystemLink Integrator CLI - cross-platform CLI for SystemLink workflows and templates."
5
5
  authors = ["Fred Visser <fred.visser@emerson.com>"]
6
6
  packages = [{ include = "slcli" }]
@@ -1,4 +1,4 @@
1
1
  """Version information for slcli."""
2
2
 
3
3
  # This file is auto-generated. Do not edit manually.
4
- __version__ = "1.13.1"
4
+ __version__ = "1.13.3"
@@ -2,8 +2,10 @@
2
2
 
3
3
  import getpass
4
4
  import json
5
+ import re
5
6
  import sys
6
7
  from typing import Any, Optional
8
+ from urllib.parse import urlparse
7
9
 
8
10
  import click
9
11
  import questionary
@@ -18,6 +20,70 @@ from .rich_output import render_table
18
20
  from .table_utils import output_formatted_list
19
21
  from .utils import ExitCodes
20
22
 
23
+ API_KEY_LENGTH = 42
24
+ API_KEY_PATTERN = re.compile(rf"^[A-Za-z0-9_-]{{{API_KEY_LENGTH}}}$")
25
+
26
+
27
+ def _exit_with_validation_error(message: str, exit_code: int = ExitCodes.INVALID_INPUT) -> None:
28
+ """Exit the command with a consistent validation message."""
29
+ click.echo(f"✗ {message}", err=True)
30
+ sys.exit(exit_code)
31
+
32
+
33
+ def _normalize_profile_name(profile: str) -> str:
34
+ """Normalize and validate a profile name."""
35
+ normalized = profile.strip()
36
+ if not normalized:
37
+ _exit_with_validation_error("Profile name cannot be empty.")
38
+ return normalized
39
+
40
+
41
+ def _normalize_base_url(raw_url: str, label: str) -> str:
42
+ """Normalize and validate a SystemLink base URL."""
43
+ normalized = raw_url.strip()
44
+ if not normalized:
45
+ _exit_with_validation_error(f"{label} cannot be empty.")
46
+
47
+ if "://" not in normalized:
48
+ click.echo(f"⚠️ Warning: Adding HTTPS protocol to {label.lower()}.")
49
+ normalized = f"https://{normalized}"
50
+
51
+ parsed = urlparse(normalized)
52
+ if parsed.scheme not in ("http", "https"):
53
+ _exit_with_validation_error(f"{label} must use HTTP or HTTPS.")
54
+ if not parsed.hostname:
55
+ _exit_with_validation_error(f"{label} must include a valid host name.")
56
+ if parsed.path and parsed.path.strip("/"):
57
+ _exit_with_validation_error(
58
+ f"{label} must be a base URL without a path, query string, or fragment."
59
+ )
60
+ if parsed.params or parsed.query or parsed.fragment:
61
+ _exit_with_validation_error(
62
+ f"{label} must be a base URL without a path, query string, or fragment."
63
+ )
64
+
65
+ return normalized.rstrip("/")
66
+
67
+
68
+ def _normalize_api_key(api_key: str) -> str:
69
+ """Normalize and validate an API key before probing the server."""
70
+ normalized = api_key.strip()
71
+ if not normalized:
72
+ _exit_with_validation_error("API key cannot be empty.")
73
+ if any(character.isspace() for character in normalized):
74
+ _exit_with_validation_error("API key must not contain spaces or line breaks.")
75
+ if not API_KEY_PATTERN.fullmatch(normalized):
76
+ _exit_with_validation_error(
77
+ f"API key must be a {API_KEY_LENGTH}-character URL-safe token containing only "
78
+ "letters, digits, '-' and '_'."
79
+ )
80
+ return normalized
81
+
82
+
83
+ def _all_service_probes_unauthorized(services: dict[str, str]) -> bool:
84
+ """Return True only when every recorded service probe failed with authorization."""
85
+ return bool(services) and all(status == "unauthorized" for status in services.values())
86
+
21
87
 
22
88
  def _add_profile_impl(
23
89
  profile: Optional[str],
@@ -46,93 +112,78 @@ def _add_profile_impl(
46
112
  if not profile:
47
113
  profile = click.prompt("Profile name", default="default")
48
114
  assert isinstance(profile, str)
115
+ profile = _normalize_profile_name(profile)
49
116
 
50
117
  # Get URL - either from flag or prompt
51
118
  if not url:
52
119
  click.echo("Example: https://api.my-systemlink.com")
53
120
  url = click.prompt("Enter your SystemLink API URL")
54
- # Ensure url is a string now
55
121
  assert isinstance(url, str)
56
- if not url.strip():
57
- click.echo("SystemLink URL cannot be empty.")
58
- raise click.ClickException("SystemLink URL cannot be empty.")
59
-
60
- # Ensure URL uses HTTPS
61
- url = url.strip()
62
- if url.startswith("http://"):
63
- click.echo("⚠️ Warning: Converting HTTP to HTTPS for security.")
64
- url = url.replace("http://", "https://", 1)
65
- elif not url.startswith("https://"):
66
- click.echo("⚠️ Warning: Adding HTTPS protocol to URL.")
67
- url = f"https://{url}"
68
- url = url.rstrip("/")
122
+ url = _normalize_base_url(url, "SystemLink API URL")
69
123
 
70
124
  # Get API key - either from flag or prompt
71
125
  if not api_key:
72
126
  api_key = getpass.getpass("Enter your SystemLink API key: ")
73
- # Ensure api_key is a string now
74
127
  assert isinstance(api_key, str)
75
- if not api_key.strip():
76
- click.echo("API key cannot be empty.")
77
- raise click.ClickException("API key cannot be empty.")
128
+ api_key = _normalize_api_key(api_key)
78
129
 
79
130
  # Normalize and validate web_url (prompt if not provided)
80
131
  if not web_url:
81
132
  click.echo("Example: https://my-systemlink.com")
82
133
  web_url = click.prompt("Enter your SystemLink Web UI URL")
83
134
  assert isinstance(web_url, str)
84
- web_url = web_url.strip()
85
- if web_url.startswith("http://"):
86
- click.echo("⚠️ Warning: Converting HTTP to HTTPS for security.")
87
- web_url = web_url.replace("http://", "https://", 1)
88
- elif not web_url.startswith("https://"):
89
- click.echo("⚠️ Warning: Adding HTTPS protocol to web URL.")
90
- web_url = f"https://{web_url}"
91
- web_url = web_url.rstrip("/")
135
+ web_url = _normalize_base_url(web_url, "SystemLink Web UI URL")
92
136
 
93
137
  # Detect platform type and check service status
94
138
  click.echo("Checking server connectivity and services...")
95
- status = check_service_status(url, api_key.strip())
139
+ status = check_service_status(url, api_key)
96
140
  platform = status["platform"]
141
+ services = status.get("services", {})
97
142
 
98
143
  if not status["server_reachable"]:
99
- click.echo(" ⚠️ Could not connect to server", err=True)
100
- click.echo(" Verify the URL is correct and the server is reachable.", err=True)
101
- click.echo(
102
- " Profile will be saved — run login again when the server is available.",
103
- err=True,
144
+ _exit_with_validation_error(
145
+ "Could not connect to the SystemLink server. Verify the URL and network access. "
146
+ "Profile was not saved.",
147
+ ExitCodes.NETWORK_ERROR,
148
+ )
149
+
150
+ if status["auth_valid"] is False and _all_service_probes_unauthorized(services):
151
+ _exit_with_validation_error(
152
+ "API key validation failed. The server responded, but the key was not authorized. "
153
+ "Profile was not saved.",
154
+ ExitCodes.PERMISSION_DENIED,
155
+ )
156
+
157
+ if status["auth_valid"] is not True:
158
+ _exit_with_validation_error(
159
+ "Connected to the server, but profile verification was inconclusive. Check the "
160
+ "API URL, API key, and service availability. Profile was not saved.",
161
+ ExitCodes.GENERAL_ERROR,
104
162
  )
163
+
164
+ click.echo(" Connection: ✓ Verified")
165
+ if platform == PLATFORM_SLE:
166
+ click.echo(" Platform: SystemLink Enterprise (Cloud)")
167
+ elif platform == PLATFORM_SLS:
168
+ click.echo(" Platform: SystemLink Server (On-Premises)")
105
169
  else:
106
- if platform == PLATFORM_SLE:
107
- click.echo(" Platform: SystemLink Enterprise (Cloud)")
108
- elif platform == PLATFORM_SLS:
109
- click.echo(" Platform: SystemLink Server (On-Premises)")
110
- else:
111
- click.echo(" Platform: Unknown (will attempt all features)")
112
-
113
- # Report authorization status
114
- if status["auth_valid"] is False:
115
- click.echo(" ⚠️ API key: Unauthorized — check that the key is valid", err=True)
116
- elif status["auth_valid"] is True:
117
- click.echo(" API key: ✓ Authorized")
118
-
119
- if status.get("file_query_endpoint") == "query-files":
120
- click.echo(" File query: query-files")
121
- elif status.get("elasticsearch_available") is False:
122
- click.echo(" File query: query-files-linq (Elasticsearch unavailable)")
123
- click.echo(
124
- " 'slcli file list' will fall back automatically; 'slcli file query' requires search-files."
125
- )
170
+ click.echo(" Platform: Unknown (will attempt all features)")
126
171
 
127
- # Report individual service status
128
- services = status.get("services", {})
129
- problem_services = [
130
- name for name, svc_status in services.items() if svc_status == "unauthorized"
131
- ]
132
- if problem_services and status["auth_valid"] is not False:
133
- # Only show per-service issues if overall auth isn't completely invalid
134
- for svc_name in problem_services:
135
- click.echo(f" ⚠️ {svc_name}: unauthorized", err=True)
172
+ click.echo(" API key: ✓ Authorized")
173
+
174
+ if status.get("file_query_endpoint") == "query-files":
175
+ click.echo(" File query: query-files")
176
+ elif status.get("elasticsearch_available") is False:
177
+ click.echo(" File query: query-files-linq (Elasticsearch unavailable)")
178
+ click.echo(
179
+ " 'slcli file list' will fall back automatically; 'slcli file query' requires search-files."
180
+ )
181
+
182
+ problem_services = [
183
+ name for name, svc_status in services.items() if svc_status == "unauthorized"
184
+ ]
185
+ for svc_name in problem_services:
186
+ click.echo(f" ⚠️ {svc_name}: unauthorized", err=True)
136
187
 
137
188
  # Get default workspace (optional)
138
189
  if workspace is None:
@@ -145,7 +196,7 @@ def _add_profile_impl(
145
196
  new_profile = Profile(
146
197
  name=profile,
147
198
  server=url,
148
- api_key=api_key.strip(),
199
+ api_key=api_key,
149
200
  web_url=web_url,
150
201
  platform=platform,
151
202
  workspace=workspace,
File without changes