licos-platform-cli 0.3.3__tar.gz → 0.4.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.

Potentially problematic release.


This version of licos-platform-cli might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: licos-platform-cli
3
- Version: 0.3.3
3
+ Version: 0.4.0
4
4
  Summary: LICOS platform CLI
5
5
  Requires-Python: >=3.10
6
- Requires-Dist: licos-platform-sdk>=0.4.2
6
+ Requires-Dist: licos-platform-sdk>=0.5.0
@@ -4,11 +4,11 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "licos-platform-cli"
7
- version = "0.3.3"
7
+ version = "0.4.0"
8
8
  description = "LICOS platform CLI"
9
9
  requires-python = ">=3.10"
10
10
  dependencies = [
11
- "licos-platform-sdk>=0.4.2",
11
+ "licos-platform-sdk>=0.5.0",
12
12
  ]
13
13
 
14
14
  [project.scripts]
@@ -508,10 +508,10 @@ UNS_HELP = {
508
508
  "discover, validate, plan, and finalize are read-only for external systems; apply performs writes.",
509
509
  "Run apply only after reviewing the current plan, and pass its exact documentHash and planHash with --confirm.",
510
510
  "UNS.json must not contain platform IDs, external IDs, credentials, MQTT infrastructure IDs, or credential-bearing RTSP URLs.",
511
- "Use resource-search before reference bindings; a reference selector must resolve exactly one existing resource.",
512
- "Point nodes are message-backed. New manifests and changes do not create point storage; existing point storage remains unchanged and does not block point operations.",
513
- "Use UNSChangeSet for supported isolated structural changes. Remove storage only on an explicit confirmed request. Unsupported operations must fail; do not regenerate a full manifest or call external services directly.",
514
- "Use either a current-project node code or --path for business access. Data writes/deletions, point control, and video control require explicit confirmation.",
511
+ "Use resource-search before reference bindings; a reference selector must resolve exactly one existing resource.",
512
+ "Point nodes are message-backed. New manifests and changes do not create point storage; existing point storage remains unchanged and does not block point operations.",
513
+ "Use UNSChangeSet for supported isolated structural changes. Remove storage only on an explicit confirmed request. Unsupported operations must fail; do not regenerate a full manifest or call external services directly.",
514
+ "Use either a current-project node code or --path for business access. Data writes/deletions, point control, and video control require explicit confirmation.",
515
515
  ],
516
516
  "sdk": {
517
517
  "python": "from licos_platform_sdk import uns\nplanned = uns.plan(document)\nresult = uns.apply(document, expected_document_hash=planned['documentHash'], expected_plan_hash=planned['planHash'], confirmed=True)",
@@ -583,7 +583,7 @@ UNS_HELP = {
583
583
  "parameters": [{"name": "--file", "required": True, "description": "Local UNS JSON file."}],
584
584
  "example": "licos-platform uns plan --file UNS.json",
585
585
  },
586
- "apply": {
586
+ "apply": {
587
587
  "description": "Execute a previously reviewed plan after explicit confirmation and hash verification.",
588
588
  "parameters": [
589
589
  {"name": "--file", "required": True, "description": "The exact local UNS JSON document that was planned."},
@@ -591,90 +591,90 @@ UNS_HELP = {
591
591
  {"name": "--plan-hash", "required": True, "description": "planHash returned by the reviewed plan."},
592
592
  {"name": "--confirm", "required": True, "description": "Explicitly confirm external writes."},
593
593
  ],
594
- "example": "licos-platform uns apply --file UNS.json --document-hash <documentHash> --plan-hash <planHash> --confirm",
595
- },
596
- "changes-validate": {
597
- "description": "Validate one strict UNSChangeSet document without writes.",
598
- "parameters": [{"name": "--file", "required": True, "description": "Local UNSChangeSet JSON file."}],
599
- "example": "licos-platform uns changes-validate --file UNS.change.json",
600
- },
601
- "changes-plan": {
602
- "description": "Resolve targets and create a read-only plan for one UNSChangeSet.",
603
- "parameters": [{"name": "--file", "required": True, "description": "Local UNSChangeSet JSON file."}],
604
- "example": "licos-platform uns changes-plan --file UNS.change.json",
605
- },
606
- "changes-apply": {
607
- "description": "Apply the exact reviewed UNSChangeSet; destructive or replacement actions require impact confirmation.",
608
- "parameters": [
609
- {"name": "--file", "required": True, "description": "The exact UNSChangeSet document that was planned."},
610
- {"name": "--document-hash", "required": True, "description": "documentHash returned by changes-plan."},
611
- {"name": "--plan-hash", "required": True, "description": "planHash returned by changes-plan."},
612
- {"name": "--confirm", "required": True, "description": "Confirm the planned writes."},
613
- {"name": "--confirm-impact", "required": False, "description": "Additionally confirm delete, move, replacement, or rebind impact."},
614
- ],
615
- "example": "licos-platform uns changes-apply --file UNS.change.json --document-hash <documentHash> --plan-hash <planHash> --confirm --confirm-impact",
616
- },
617
- "node-update": {
618
- "description": "Build and plan one supported node metadata update; this command never applies it.",
619
- "parameters": [
620
- {"name": "--path / --node-code", "required": True, "description": "Exactly one project-local target locator."},
621
- {"name": "--set-json", "required": True, "description": "Supported node fields to replace."},
622
- ],
623
- "example": "licos-platform uns node-update --path project:/LINE_1/TEMP_1 --set-json '{\"name\":\"炉温\"}'",
624
- },
625
- "node-move": {
626
- "description": "Build and plan one project-local node move; this command never applies it.",
627
- "parameters": [
628
- {"name": "--path / --node-code", "required": True, "description": "Exactly one target locator."},
629
- {"name": "--parent-path / --parent-node-code", "required": True, "description": "Exactly one destination locator."},
630
- ],
631
- "example": "licos-platform uns node-move --node-code TEMP_1 --parent-path project:/LINE_2",
632
- },
633
- "point-rebind": {
634
- "description": "Build and plan rebinding one point to one exact existing collection point; this command never applies it.",
635
- "parameters": [
636
- {"name": "--path / --node-code", "required": True, "description": "Exactly one point target locator."},
637
- {"name": "--selector-json", "required": True, "description": "Exact tagCode, taskName, and protocol selector."},
638
- {"name": "--field-mappings-json", "required": False, "description": "Optional field mapping array."},
639
- ],
640
- "example": "licos-platform uns point-rebind --node-code TEMP_1 --selector-json '{\"tagCode\":\"T1\",\"taskName\":\"OPC采集\",\"protocol\":\"opcua\"}'",
641
- },
642
- "directory-create": {
643
- "description": "Build and plan creating one project-local grouping directory; this command never applies it.",
644
- "parameters": [
645
- {"name": "--parent-path / --parent-node-code", "required": True, "description": "Exactly one parent locator."},
646
- {"name": "--node-json", "required": True, "description": "Directory name, stable code, and optional metadata."},
647
- ],
648
- "example": "licos-platform uns directory-create --parent-path project:/ --node-json '{\"name\":\"一号产线\",\"code\":\"LINE_1\"}'",
649
- },
650
- "connection-update": {
651
- "description": "生成并规划一个当前项目托管采集连接的增量修改,不直接执行写入。",
652
- "parameters": [
653
- {"name": "--selector-json", "required": True, "description": "精确的 name、protocol 选择器。"},
654
- {"name": "--set-json", "required": True, "description": "name、credentialRef 或 configPatch。"},
655
- {"name": "--output", "required": False, "description": "在项目目录内保存生成的 UNSChangeSet。"},
656
- ],
657
- "example": "licos-platform uns connection-update --selector-json '{\"name\":\"一号PLC\",\"protocol\":\"modbus-tcp\"}' --set-json '{\"configPatch\":{\"host\":\"10.0.0.2\"}}' --output UNS.change.json",
658
- },
659
- "collection-task-update": {
660
- "description": "生成并规划一个当前项目托管采集任务的增量修改,不直接执行写入。",
661
- "parameters": [
662
- {"name": "--selector-json", "required": True, "description": "精确的 name、protocol、connectionName 选择器。"},
663
- {"name": "--set-json", "required": True, "description": "name、pollIntervalMs、enabled 或 configPatch。"},
664
- {"name": "--output", "required": False, "description": "在项目目录内保存生成的 UNSChangeSet。"},
665
- ],
666
- "example": "licos-platform uns collection-task-update --selector-json '{\"name\":\"温度采集\",\"protocol\":\"modbus-tcp\",\"connectionName\":\"一号PLC\"}' --set-json '{\"pollIntervalMs\":2000}' --output UNS.change.json",
667
- },
668
- "point-config-update": {
669
- "description": "生成并规划一个当前项目托管采集点位配置的增量修改,不改变点位编码和所属任务。",
670
- "parameters": [
671
- {"name": "--selector-json", "required": True, "description": "精确的 tagCode、taskName、protocol 选择器。"},
672
- {"name": "--set-json", "required": True, "description": "点位通用字段或协议 addressPatch。"},
673
- {"name": "--output", "required": False, "description": "在项目目录内保存生成的 UNSChangeSet。"},
674
- ],
675
- "example": "licos-platform uns point-config-update --selector-json '{\"tagCode\":\"TEMP_01\",\"taskName\":\"温度采集\",\"protocol\":\"modbus-tcp\"}' --set-json '{\"addressPatch\":{\"address\":\"40002\"}}' --output UNS.change.json",
676
- },
677
- "finalize": {
594
+ "example": "licos-platform uns apply --file UNS.json --document-hash <documentHash> --plan-hash <planHash> --confirm",
595
+ },
596
+ "changes-validate": {
597
+ "description": "Validate one strict UNSChangeSet document without writes.",
598
+ "parameters": [{"name": "--file", "required": True, "description": "Local UNSChangeSet JSON file."}],
599
+ "example": "licos-platform uns changes-validate --file UNS.change.json",
600
+ },
601
+ "changes-plan": {
602
+ "description": "Resolve targets and create a read-only plan for one UNSChangeSet.",
603
+ "parameters": [{"name": "--file", "required": True, "description": "Local UNSChangeSet JSON file."}],
604
+ "example": "licos-platform uns changes-plan --file UNS.change.json",
605
+ },
606
+ "changes-apply": {
607
+ "description": "Apply the exact reviewed UNSChangeSet; destructive or replacement actions require impact confirmation.",
608
+ "parameters": [
609
+ {"name": "--file", "required": True, "description": "The exact UNSChangeSet document that was planned."},
610
+ {"name": "--document-hash", "required": True, "description": "documentHash returned by changes-plan."},
611
+ {"name": "--plan-hash", "required": True, "description": "planHash returned by changes-plan."},
612
+ {"name": "--confirm", "required": True, "description": "Confirm the planned writes."},
613
+ {"name": "--confirm-impact", "required": False, "description": "Additionally confirm delete, move, replacement, or rebind impact."},
614
+ ],
615
+ "example": "licos-platform uns changes-apply --file UNS.change.json --document-hash <documentHash> --plan-hash <planHash> --confirm --confirm-impact",
616
+ },
617
+ "node-update": {
618
+ "description": "Build and plan one supported node metadata update; this command never applies it.",
619
+ "parameters": [
620
+ {"name": "--path / --node-code", "required": True, "description": "Exactly one project-local target locator."},
621
+ {"name": "--set-json", "required": True, "description": "Supported node fields to replace."},
622
+ ],
623
+ "example": "licos-platform uns node-update --path project:/LINE_1/TEMP_1 --set-json '{\"name\":\"炉温\"}'",
624
+ },
625
+ "node-move": {
626
+ "description": "Build and plan one project-local node move; this command never applies it.",
627
+ "parameters": [
628
+ {"name": "--path / --node-code", "required": True, "description": "Exactly one target locator."},
629
+ {"name": "--parent-path / --parent-node-code", "required": True, "description": "Exactly one destination locator."},
630
+ ],
631
+ "example": "licos-platform uns node-move --node-code TEMP_1 --parent-path project:/LINE_2",
632
+ },
633
+ "point-rebind": {
634
+ "description": "Build and plan rebinding one point to one exact existing collection point; this command never applies it.",
635
+ "parameters": [
636
+ {"name": "--path / --node-code", "required": True, "description": "Exactly one point target locator."},
637
+ {"name": "--selector-json", "required": True, "description": "Exact tagCode, taskName, and protocol selector."},
638
+ {"name": "--field-mappings-json", "required": False, "description": "Optional field mapping array."},
639
+ ],
640
+ "example": "licos-platform uns point-rebind --node-code TEMP_1 --selector-json '{\"tagCode\":\"T1\",\"taskName\":\"OPC采集\",\"protocol\":\"opcua\"}'",
641
+ },
642
+ "directory-create": {
643
+ "description": "Build and plan creating one project-local grouping directory; this command never applies it.",
644
+ "parameters": [
645
+ {"name": "--parent-path / --parent-node-code", "required": True, "description": "Exactly one parent locator."},
646
+ {"name": "--node-json", "required": True, "description": "Directory name, stable code, and optional metadata."},
647
+ ],
648
+ "example": "licos-platform uns directory-create --parent-path project:/ --node-json '{\"name\":\"一号产线\",\"code\":\"LINE_1\"}'",
649
+ },
650
+ "connection-update": {
651
+ "description": "生成并规划一个当前项目托管采集连接的增量修改,不直接执行写入。",
652
+ "parameters": [
653
+ {"name": "--selector-json", "required": True, "description": "精确的 name、protocol 选择器。"},
654
+ {"name": "--set-json", "required": True, "description": "name、credentialRef 或 configPatch。"},
655
+ {"name": "--output", "required": False, "description": "在项目目录内保存生成的 UNSChangeSet。"},
656
+ ],
657
+ "example": "licos-platform uns connection-update --selector-json '{\"name\":\"一号PLC\",\"protocol\":\"modbus-tcp\"}' --set-json '{\"configPatch\":{\"host\":\"10.0.0.2\"}}' --output UNS.change.json",
658
+ },
659
+ "collection-task-update": {
660
+ "description": "生成并规划一个当前项目托管采集任务的增量修改,不直接执行写入。",
661
+ "parameters": [
662
+ {"name": "--selector-json", "required": True, "description": "精确的 name、protocol、connectionName 选择器。"},
663
+ {"name": "--set-json", "required": True, "description": "name、pollIntervalMs、enabled 或 configPatch。"},
664
+ {"name": "--output", "required": False, "description": "在项目目录内保存生成的 UNSChangeSet。"},
665
+ ],
666
+ "example": "licos-platform uns collection-task-update --selector-json '{\"name\":\"温度采集\",\"protocol\":\"modbus-tcp\",\"connectionName\":\"一号PLC\"}' --set-json '{\"pollIntervalMs\":2000}' --output UNS.change.json",
667
+ },
668
+ "point-config-update": {
669
+ "description": "生成并规划一个当前项目托管采集点位配置的增量修改,不改变点位编码和所属任务。",
670
+ "parameters": [
671
+ {"name": "--selector-json", "required": True, "description": "精确的 tagCode、taskName、protocol 选择器。"},
672
+ {"name": "--set-json", "required": True, "description": "点位通用字段或协议 addressPatch。"},
673
+ {"name": "--output", "required": False, "description": "在项目目录内保存生成的 UNSChangeSet。"},
674
+ ],
675
+ "example": "licos-platform uns point-config-update --selector-json '{\"tagCode\":\"TEMP_01\",\"taskName\":\"温度采集\",\"protocol\":\"modbus-tcp\"}' --set-json '{\"addressPatch\":{\"address\":\"40002\"}}' --output UNS.change.json",
676
+ },
677
+ "finalize": {
678
678
  "description": "Validate and atomically install a candidate as project-root UNS.json, revalidate it, and return a read-only plan.",
679
679
  "parameters": [{"name": "--file", "required": True, "description": "Candidate JSON file inside LICOS_PROJECT_PATH."}],
680
680
  "example": "licos-platform uns finalize --file .UNS.json.candidate",
@@ -767,11 +767,116 @@ UNS_HELP = {
767
767
  }
768
768
 
769
769
 
770
- HELP_TOPICS = {
770
+ INDUSTRIAL_HELP = {
771
+ "topic": "industrial",
772
+ "description": "Project-scoped direct collection and video integration without creating UNS nodes.",
773
+ "runtime": RUNTIME_ENV,
774
+ "rules": [
775
+ "Use only when the user explicitly requests direct collector access or explicitly says not to create UNS.",
776
+ "CLI and SDK call platform APIs; never request or expose IOTDATA API keys or MQTT credentials.",
777
+ "Search before create. Update and delete require the versionHash returned by resource-get/search.",
778
+ "Apply requires reviewed documentHash and planHash. Delete also requires --confirm-impact.",
779
+ "Realtime defaults to WebSocket; MQTT must be selected explicitly. Point control defaults to HTTP; MQTT must be selected explicitly.",
780
+ "Transport failures do not silently switch to another transport.",
781
+ ],
782
+ "resourceTypes": [
783
+ "edgeAgent (read-only)",
784
+ "connection",
785
+ "collectionTask",
786
+ "collectionPoint",
787
+ "videoEdge",
788
+ "videoGateway",
789
+ "videoDevice",
790
+ "videoChannel",
791
+ ],
792
+ "commands": {
793
+ "protocol-schema": {
794
+ "description": "Get required and default fields for one collection protocol.",
795
+ "parameters": [{"name": "protocol", "required": True, "description": "Protocol code."}],
796
+ "example": "licos-platform industrial protocol-schema modbus-tcp",
797
+ },
798
+ "resource-search": {
799
+ "description": "Search project-managed or enterprise collection/video resources.",
800
+ "parameters": [
801
+ {"name": "--resource-type", "required": True, "description": "Allowlisted resource type."},
802
+ {"name": "--scope", "required": False, "description": "project or enterprise."},
803
+ {"name": "--protocol", "required": False, "description": "Collection protocol filter."},
804
+ {"name": "--keyword", "required": False, "description": "Name/code/address keyword."},
805
+ {"name": "--selector-json", "required": False, "description": "Exact field selector object."},
806
+ ],
807
+ "example": "licos-platform industrial resource-search --resource-type collectionPoint --scope enterprise --keyword TEMP",
808
+ },
809
+ "resource-get": {
810
+ "description": "Get one resource, writable state, and concurrency versionHash.",
811
+ "parameters": [
812
+ {"name": "--resource-type", "required": True, "description": "Allowlisted resource type."},
813
+ {"name": "--resource-id", "required": True, "description": "Resource ID."},
814
+ ],
815
+ "example": "licos-platform industrial resource-get --resource-type collectionPoint --resource-id point-id",
816
+ },
817
+ "changes-validate / changes-plan / changes-apply": {
818
+ "description": "Validate, review, and apply an IndustrialChangeSet JSON file.",
819
+ "parameters": [
820
+ {"name": "--file", "required": True, "description": "IndustrialChangeSet JSON file."},
821
+ {"name": "--document-hash / --plan-hash", "required": True, "description": "Required only by apply."},
822
+ {"name": "--confirm", "required": True, "description": "Required only by apply."},
823
+ {"name": "--confirm-impact", "required": False, "description": "Required when the plan contains delete impact."},
824
+ ],
825
+ "example": "licos-platform industrial changes-plan --file ./industrial.change.json",
826
+ },
827
+ "resource-create / resource-update / resource-delete": {
828
+ "description": "Generate and plan one operation; these commands do not apply writes.",
829
+ "parameters": [
830
+ {"name": "--resource-type", "required": True, "description": "Allowlisted resource type."},
831
+ {"name": "--spec-json / --set-json", "required": False, "description": "Create or update fields."},
832
+ {"name": "--resource-id / --version-hash", "required": False, "description": "Required by update/delete."},
833
+ {"name": "--output", "required": False, "description": "Write the generated ChangeSet under LICOS_PROJECT_PATH."},
834
+ ],
835
+ "example": "licos-platform industrial resource-update --resource-type collectionPoint --resource-id point-id --version-hash HASH --set-json '{\"name\":\"炉温\"}'",
836
+ },
837
+ "realtime-config": {
838
+ "description": "Build the platform WebSocket URL and subscribe message for application code.",
839
+ "parameters": [
840
+ {"name": "--point-id / --tag-code", "required": True, "description": "At least one selector; repeatable."},
841
+ {"name": "--transport", "required": False, "description": "auto/websocket defaults to WebSocket; mqtt is explicit."},
842
+ ],
843
+ "example": "licos-platform industrial realtime-config --point-id point-id --transport websocket",
844
+ },
845
+ "point-current / point-history": {
846
+ "description": "Read current or historical point values.",
847
+ "parameters": [{"name": "point_id", "required": True, "description": "Collection point ID."}],
848
+ "example": "licos-platform industrial point-current point-id",
849
+ },
850
+ "point-write": {
851
+ "description": "Dry-run or control a writable project-managed point.",
852
+ "parameters": [
853
+ {"name": "point_id", "required": True, "description": "Collection point ID."},
854
+ {"name": "--value-json", "required": True, "description": "JSON scalar/object value."},
855
+ {"name": "--reason / --ticket", "required": True, "description": "Audit reason and ticket."},
856
+ {"name": "--transport", "required": False, "description": "auto/http defaults to HTTP; mqtt is explicit."},
857
+ {"name": "--dry-run / --confirm", "required": True, "description": "One safety mode is required."},
858
+ ],
859
+ "example": "licos-platform industrial point-write point-id --value-json 80 --reason 调试 --ticket T-1 --confirm",
860
+ },
861
+ "video-stream / video-start / video-stop": {
862
+ "description": "Get playback options or explicitly start/stop a project-managed video preview.",
863
+ "parameters": [
864
+ {"name": "channel_id", "required": True, "description": "Video channel ID."},
865
+ {"name": "--protocol", "required": False, "description": "Start defaults to http-flv."},
866
+ {"name": "--confirm", "required": True, "description": "Required by start/stop."},
867
+ ],
868
+ "example": "licos-platform industrial video-start channel-id --protocol http-flv --confirm",
869
+ },
870
+ },
871
+ }
872
+
873
+
874
+ HELP_TOPICS = {
771
875
  "storage": STORAGE_HELP,
772
876
  "database": DATABASE_HELP,
773
877
  "knowledge": KNOWLEDGE_HELP,
774
- "oauth": OAUTH_HELP,
878
+ "oauth": OAUTH_HELP,
879
+ "industrial": INDUSTRIAL_HELP,
775
880
  "uns": UNS_HELP,
776
881
  }
777
882