fix(cli): align actor context CLI with robot test — add delete alias and positional path args #3179
@@ -16,7 +16,7 @@ ${CONTEXT_NAME} roundtrip-robot
|
||||
|
||||
*** Test Cases ***
|
||||
Export Then Import Round-Trip Preserves Context
|
||||
[Documentation] Create a context, export it, delete it, import it, and verify data integrity.
|
||||
[Documentation] Create a context, export it, remove it, import it, and verify data integrity.
|
||||
|
||||
# 1. Create a named context by running actor with --context
|
||||
${ctx_dir} = Set Variable ${TEMP}/actor_ctx
|
||||
@@ -36,23 +36,23 @@ Export Then Import Round-Trip Preserves Context
|
||||
Set Suite Variable ${EXPORT_FILE} ${export_path}
|
||||
|
||||
${result} = Run Process ${PYTHON} -m cleveragents actor context export
|
||||
... ${CONTEXT_NAME} ${export_path} --context-dir ${ctx_dir}
|
||||
... ${CONTEXT_NAME} --output ${export_path} --context-dir ${ctx_dir}
|
||||
Log Export stdout: ${result.stdout}
|
||||
Log Export stderr: ${result.stderr}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
File Should Exist ${export_path}
|
||||
|
||||
# 3. Delete the original context
|
||||
${result} = Run Process ${PYTHON} -m cleveragents actor context delete
|
||||
# 3. Remove the original context
|
||||
${result} = Run Process ${PYTHON} -m cleveragents actor context remove
|
||||
... ${CONTEXT_NAME} --yes --context-dir ${ctx_dir}
|
||||
Log Delete stdout: ${result.stdout}
|
||||
Log Delete stderr: ${result.stderr}
|
||||
Log Remove stdout: ${result.stdout}
|
||||
Log Remove stderr: ${result.stderr}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Directory Should Not Exist ${ctx_dir}/${CONTEXT_NAME}
|
||||
|
||||
# 4. Import the context back
|
||||
${result} = Run Process ${PYTHON} -m cleveragents actor context import
|
||||
... ${CONTEXT_NAME} ${export_path} --context-dir ${ctx_dir}
|
||||
... ${CONTEXT_NAME} --input ${export_path} --context-dir ${ctx_dir}
|
||||
Log Import stdout: ${result.stdout}
|
||||
Log Import stderr: ${result.stderr}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -76,10 +76,10 @@ Export With JSON Format Flag Shows Structured Output
|
||||
... from cleveragents.reactive.context_manager import ContextManager; mgr \= ContextManager("fmt-test", "${ctx_dir}"); mgr.add_message("user", "test"); print("ok")
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
# Export to JSON file (positional arg)
|
||||
# Export to JSON file using --output option (per spec)
|
||||
${export_path} = Set Variable ${TEMP}/fmt-export.json
|
||||
${result} = Run Process ${PYTHON} -m cleveragents actor context export
|
||||
... fmt-test ${export_path} --context-dir ${ctx_dir}
|
||||
... fmt-test --output ${export_path} --context-dir ${ctx_dir}
|
||||
Log Export stdout: ${result.stdout}
|
||||
Log Export stderr: ${result.stderr}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -102,9 +102,9 @@ Import Into Existing Context Overwrites Data
|
||||
... import json; data \= {"context_name": "existing", "messages": [{"role": "user", "content": "new", "timestamp": "2026-01-01", "metadata": {}}], "metadata": {}, "state": {}, "global_context": {}}; open("${import_path}", "w").write(json.dumps(data)); print("ok")
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
# Import should succeed (overwrites existing context)
|
||||
# Import should succeed (overwrites existing context using --update flag)
|
||||
${result} = Run Process ${PYTHON} -m cleveragents actor context import
|
||||
... existing ${import_path} --context-dir ${ctx_dir}
|
||||
... existing --input ${import_path} --update --context-dir ${ctx_dir}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
*** Keywords ***
|
||||
|
||||
Reference in New Issue
Block a user