licos-platform-cli 0.7.0__tar.gz → 0.8.0__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.
- licos_platform_cli-0.7.0/README.md → licos_platform_cli-0.8.0/PKG-INFO +12 -0
- licos_platform_cli-0.7.0/PKG-INFO → licos_platform_cli-0.8.0/README.md +4 -8
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/pyproject.toml +2 -2
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/help_commands.py +1 -1
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/ontology_package_commands.py +19 -5
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/tests/test_ontology_packages.py +10 -1
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/.gitignore +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/__init__.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/database_commands.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/identity.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/knowledge_commands.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/main.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/oauth_commands.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/ontology_commands.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/project_config_commands.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/storage_commands.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/user_commands.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/tests/test_cli.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/tests/test_identity.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/tests/test_project_config.py +0 -0
- {licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/tests/test_user.py +0 -0
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: licos-platform-cli
|
|
3
|
+
Version: 0.8.0
|
|
4
|
+
Summary: LICOS platform CLI
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: licos-platform-sdk>=0.9.0
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
1
9
|
# licos-platform-cli
|
|
2
10
|
|
|
3
11
|
LICOS 平台命令行工具。`licos-platform help` 返回结构化 JSON 帮助。
|
|
@@ -57,6 +65,10 @@ result = subprocess.run(
|
|
|
57
65
|
|
|
58
66
|
显式传入的 Token 鉴权失败时返回非零退出码,由调用方更新登录凭证,不切换到容器用户或项目所有者。项目所有者和工作空间等资源归属字段单独保留,不用它们冒充调用用户。
|
|
59
67
|
|
|
68
|
+
## 本体正式版本
|
|
69
|
+
|
|
70
|
+
0.8.0 起,`ontology package/bind --root-object-id <id>` 自动选择最新正式版;使用显式 release_id 固定版本。`ontology resolve --configuration-file ontology.json` 解析 `{versionPolicy, rootObjectId, binding}`,省略策略保持固定版本。新运行开始解析并保存输出绑定,query/function 及恢复执行复用它,不在每次查询时重新解析。新版缺少已选对象、属性或函数时直接失败。
|
|
71
|
+
|
|
60
72
|
## 编程项目登录身份
|
|
61
73
|
|
|
62
74
|
- 有内置登录时使用内置登录会话;没有内置登录时使用当前 LICOS 网页登录。内置登录未登录或过期时不能切换成平台用户。
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: licos-platform-cli
|
|
3
|
-
Version: 0.7.0
|
|
4
|
-
Summary: LICOS platform CLI
|
|
5
|
-
Requires-Python: >=3.10
|
|
6
|
-
Requires-Dist: licos-platform-sdk>=0.8.0
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
|
|
9
1
|
# licos-platform-cli
|
|
10
2
|
|
|
11
3
|
LICOS 平台命令行工具。`licos-platform help` 返回结构化 JSON 帮助。
|
|
@@ -65,6 +57,10 @@ result = subprocess.run(
|
|
|
65
57
|
|
|
66
58
|
显式传入的 Token 鉴权失败时返回非零退出码,由调用方更新登录凭证,不切换到容器用户或项目所有者。项目所有者和工作空间等资源归属字段单独保留,不用它们冒充调用用户。
|
|
67
59
|
|
|
60
|
+
## 本体正式版本
|
|
61
|
+
|
|
62
|
+
0.8.0 起,`ontology package/bind --root-object-id <id>` 自动选择最新正式版;使用显式 release_id 固定版本。`ontology resolve --configuration-file ontology.json` 解析 `{versionPolicy, rootObjectId, binding}`,省略策略保持固定版本。新运行开始解析并保存输出绑定,query/function 及恢复执行复用它,不在每次查询时重新解析。新版缺少已选对象、属性或函数时直接失败。
|
|
63
|
+
|
|
68
64
|
## 编程项目登录身份
|
|
69
65
|
|
|
70
66
|
- 有内置登录时使用内置登录会话;没有内置登录时使用当前 LICOS 网页登录。内置登录未登录或过期时不能切换成平台用户。
|
|
@@ -4,12 +4,12 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "licos-platform-cli"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.8.0"
|
|
8
8
|
description = "LICOS platform CLI"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"licos-platform-sdk>=0.
|
|
12
|
+
"licos-platform-sdk>=0.9.0",
|
|
13
13
|
]
|
|
14
14
|
|
|
15
15
|
[project.scripts]
|
{licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/help_commands.py
RENAMED
|
@@ -799,7 +799,7 @@ ONTOLOGY_HELP = {
|
|
|
799
799
|
"Resolve elements by stable IDs before querying context, model checks, or mapped data.",
|
|
800
800
|
"elementId/objectElementId 是部署实例 ID;objectTypeId 从实例上下文读取,是对象模板 ID。",
|
|
801
801
|
"函数使用目录中的 apiName 和 version,input 满足 inputSchema;objects 传对象导入描述,每组需明确部署实例。动作仍使用列表 id 作为 actionTypeId。",
|
|
802
|
-
"
|
|
802
|
+
"正式应用默认用 ontology package/bind --root-object-id 选择最新正式版;显式 release_id 固定版本。ontology resolve 在新运行开始解析配置,保存绑定供整轮及恢复复用。函数版本仍显式固定,不能调用 CURRENT 或包外函数。",
|
|
803
803
|
"动作预览明确传入 objectElementId 和真实 objectKey;用户确认后用同一草稿的 confirmationId 执行。实例参数必须已在当前工具 schema 中声明,缺失时报告上游目录问题。",
|
|
804
804
|
"READ tools query state, PREPARE tools validate a change draft, and PERSIST tools apply an explicitly confirmed draft.",
|
|
805
805
|
"PERSIST commands require --confirm. Never reuse a catalog result after its catalogVersion changes.",
|
|
@@ -11,13 +11,18 @@ from .identity import add_user_token_option, user_token
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
PACKAGE_HELP = {
|
|
14
|
+
"resolve": {"description": "Resolve a latestPublished/pinned selection once at run start. Persist the returned binding for all queries and resume.",
|
|
15
|
+
"parameters": [{"name": "--configuration-file", "required": True, "description": "JSON containing binding, versionPolicy and rootObjectId."}],
|
|
16
|
+
"example": "licos-platform ontology resolve --configuration-file ontology.json"},
|
|
14
17
|
"releases": {"description": "List visible published releases using the current execution identity.", "parameters": [],
|
|
15
18
|
"example": "licos-platform ontology releases"},
|
|
16
19
|
"package": {"description": "Inspect semantic metadata of a specific release; excludes physical mappings and implementation DSL.",
|
|
17
|
-
"parameters": [{"name": "release_id", "required":
|
|
20
|
+
"parameters": [{"name": "release_id", "required": False, "description": "Pinned release; mutually exclusive with --root-object-id."},
|
|
21
|
+
{"name": "--root-object-id", "required": False, "description": "Inspect the latest formally published release of this ontology root."}],
|
|
18
22
|
"example": "licos-platform ontology package <release_id>"},
|
|
19
23
|
"bind": {"description": "Create a binding JSON for a published release; save the output in trusted application configuration.",
|
|
20
|
-
"parameters": [{"name": "release_id", "required":
|
|
24
|
+
"parameters": [{"name": "release_id", "required": False, "description": "Pinned release; mutually exclusive with --root-object-id."},
|
|
25
|
+
{"name": "--root-object-id", "required": False, "description": "Resolve latest formally published model once for this run."},
|
|
21
26
|
{"name": "--objects-file", "required": True, "description": "JSON array of elementId and attributeIds selections."},
|
|
22
27
|
{"name": "--functions-file", "required": False, "description": "JSON array of apiName/version selections. Omitted selects no functions."}],
|
|
23
28
|
"example": "licos-platform ontology bind <release_id> --objects-file objects.json --functions-file functions.json"},
|
|
@@ -83,10 +88,14 @@ def _run(args: argparse.Namespace) -> Any:
|
|
|
83
88
|
if operation == "releases":
|
|
84
89
|
return ontology.list_releases(user_token=token)
|
|
85
90
|
if operation == "package":
|
|
86
|
-
return ontology.
|
|
91
|
+
return (ontology.get_latest_package(args.root_object_id, user_token=token) if args.root_object_id
|
|
92
|
+
else ontology.get_package(args.release_id, user_token=token))
|
|
87
93
|
if operation == "bind":
|
|
88
|
-
|
|
94
|
+
bind = ontology.create_latest_binding if args.root_object_id else ontology.create_binding
|
|
95
|
+
return bind(args.root_object_id or args.release_id, _file(args.objects_file),
|
|
89
96
|
_file(args.functions_file) if args.functions_file else [], user_token=token)
|
|
97
|
+
if operation == "resolve":
|
|
98
|
+
return ontology.resolve_binding(_file(args.configuration_file), user_token=token)
|
|
90
99
|
if operation == "diff":
|
|
91
100
|
before = ontology.get_package(args.before, user_token=token)
|
|
92
101
|
after = ontology.get_package(args.after, user_token=token)
|
|
@@ -105,6 +114,7 @@ def add_package_commands(commands: argparse._SubParsersAction) -> None:
|
|
|
105
114
|
("releases", "List visible published ontology releases"),
|
|
106
115
|
("package", "Inspect semantic metadata of one release"),
|
|
107
116
|
("bind", "Create an explicit release and capability binding"),
|
|
117
|
+
("resolve", "Resolve a saved version policy once at run start"),
|
|
108
118
|
("validate", "Verify a binding against its published artifact"),
|
|
109
119
|
("query", "Query business objects within a binding"),
|
|
110
120
|
("function", "Invoke a versioned read-only function within a binding"),
|
|
@@ -114,7 +124,11 @@ def add_package_commands(commands: argparse._SubParsersAction) -> None:
|
|
|
114
124
|
add_user_token_option(parser)
|
|
115
125
|
parser.set_defaults(handler=_run)
|
|
116
126
|
if name in {"package", "bind"}:
|
|
117
|
-
parser.
|
|
127
|
+
selection = parser.add_mutually_exclusive_group(required=True)
|
|
128
|
+
selection.add_argument("release_id", nargs="?")
|
|
129
|
+
selection.add_argument("--root-object-id", help="Use the latest formally published release of this stable ontology root")
|
|
130
|
+
if name == "resolve":
|
|
131
|
+
parser.add_argument("--configuration-file", required=True)
|
|
118
132
|
if name in {"validate", "query", "function"}:
|
|
119
133
|
parser.add_argument("--binding-file", required=True)
|
|
120
134
|
if name == "bind":
|
|
@@ -16,7 +16,7 @@ from test_cli import run_cli
|
|
|
16
16
|
|
|
17
17
|
class OntologyPackageCliTests(unittest.TestCase):
|
|
18
18
|
def test_package_commands_have_structured_help(self):
|
|
19
|
-
for command in ("releases", "package", "bind", "validate", "query", "function", "diff"):
|
|
19
|
+
for command in ("releases", "package", "bind", "resolve", "validate", "query", "function", "diff"):
|
|
20
20
|
code, output, error = run_cli("help", "ontology", command)
|
|
21
21
|
self.assertEqual((code, error), (0, ""))
|
|
22
22
|
self.assertIn("parameters", json.loads(output))
|
|
@@ -26,6 +26,15 @@ class OntologyPackageCliTests(unittest.TestCase):
|
|
|
26
26
|
identity.start()
|
|
27
27
|
self.addCleanup(identity.stop)
|
|
28
28
|
|
|
29
|
+
@patch("licos_platform_cli.identity.runtime_user_token", return_value="caller-token")
|
|
30
|
+
@patch("licos_platform_cli.ontology_package_commands.ontology.get_latest_package", return_value={"version": "V2"})
|
|
31
|
+
def test_latest_package_selects_by_root_and_rejects_ambiguous_input(self, latest, _identity):
|
|
32
|
+
code, _, error = run_cli("ontology", "package", "--root-object-id", "root-1")
|
|
33
|
+
self.assertEqual((code, error), (0, ""))
|
|
34
|
+
latest.assert_called_once_with("root-1", user_token="caller-token")
|
|
35
|
+
code, _, _ = run_cli("ontology", "package", "release-1", "--root-object-id", "root-1")
|
|
36
|
+
self.assertNotEqual(code, 0)
|
|
37
|
+
|
|
29
38
|
@patch("licos_platform_cli.identity.runtime_user_token", return_value="caller-token")
|
|
30
39
|
@patch("licos_platform_cli.ontology_package_commands.ontology.list_releases", return_value=[])
|
|
31
40
|
def test_releases_forwards_runtime_identity(self, releases, _identity):
|
|
File without changes
|
|
File without changes
|
{licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/database_commands.py
RENAMED
|
File without changes
|
|
File without changes
|
{licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/knowledge_commands.py
RENAMED
|
File without changes
|
|
File without changes
|
{licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/oauth_commands.py
RENAMED
|
File without changes
|
{licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/ontology_commands.py
RENAMED
|
File without changes
|
|
File without changes
|
{licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/storage_commands.py
RENAMED
|
File without changes
|
{licos_platform_cli-0.7.0 → licos_platform_cli-0.8.0}/src/licos_platform_cli/user_commands.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|