Skip to content

gh70 - xts demo#72

Open
zghp wants to merge 1 commit into
developfrom
feature/gh70-xts-demo
Open

gh70 - xts demo#72
zghp wants to merge 1 commit into
developfrom
feature/gh70-xts-demo

Conversation

@zghp

@zghp zghp commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@zghp zghp self-assigned this Jun 22, 2026
Copilot AI review requested due to automatic review settings June 22, 2026 12:20
@zghp zghp requested a review from a team as a code owner June 22, 2026 12:20
@zghp zghp added the enhancement New feature or request label Jun 22, 2026
@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


zghp seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@zghp zghp linked an issue Jun 22, 2026 that may be closed by this pull request
@zghp zghp requested a review from TB-1993 June 22, 2026 12:24
@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/xts_core/72/rdkcentral/xts_core

  • Commit: 6c24028

Report detail: gist'

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an xts demo built-in command intended to walk first-time users through alias setup and running a sample command, along with test coverage and README updates.

Changes:

  • Adds a demo built-in path in XTS._parse_first_arg() and an interactive _run_demo() flow.
  • Adds a pytest that exercises the demo flow via monkeypatching and a fake YamlRunner.
  • Documents the new xts demo command in the README.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
src/xts_core/xts.py Adds demo built-in handling, interactive demo flow, and a YamlRunner-compatibility fallback.
test/test_xts_all_cases.py Adds an end-to-end-ish test for xts demo and adjusts import path handling.
README.md Documents the new interactive demo command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/xts_core/xts.py
Comment on lines 4 to 8
# * If not stated otherwise in this file or this component's LICENSE file the
# * following copyright and licenses apply:
# *
# * Copyright 2024 RDK Management
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.

# * You may obtain a copy of the License at
Comment thread src/xts_core/xts.py
Comment on lines 191 to 198
alias_name = remaining_args[0]

if alias_name == 'demo':
self._run_demo()
raise SystemExit(0)

resolved_xts_path = xts_alias.resolve_alias_to_xts_path(alias_name)

Comment thread src/xts_core/xts.py
Comment on lines +248 to +260
package_root = Path(__file__).resolve().parents[2]
example_config = package_root / 'examples' / 'hello_world.xts'
if example_config.exists():
return str(example_config)

alt_example = Path.cwd() / 'examples' / 'hello_world.xts'
if alt_example.exists():
return str(alt_example)

error(
'Could not locate demo example config. Ensure examples/hello_world.xts exists.'
)

Comment thread src/xts_core/xts.py
Comment on lines +261 to +275
def _collect_command_paths(self, section: dict, prefix: list[str] | None = None) -> list[list[str]]:
"""Recursively collect leaf command paths from a command section."""
prefix = prefix or []
paths: list[list[str]] = []

for key, value in section.items():
if not isinstance(value, dict):
continue

if 'command' in value:
paths.append(prefix + [key])

paths.extend(self._collect_command_paths(value, prefix + [key]))

return paths
Comment thread src/xts_core/xts.py
Comment on lines +282 to +284
info('Welcome to the XTS interactive demo!')
info('This demo will add an alias, show the alias list, and run all example commands.')
print()
Comment thread src/xts_core/xts.py
Comment on lines +286 to +291
help_command = 'xts --alias --help'
add_command = f'xts --alias --add {example_config_path} --name {alias_name}'
list_command = 'xts --alias --list'
run_command = f'xts {alias_name} run hello_world'
remove_command = f'xts --alias --remove {alias_name}'

Comment thread src/xts_core/xts.py
Comment on lines +347 to +357
print()
info('Section 5: Remove the demo alias.')
info(f' Command: {remove_command}')
input('Press Enter to execute this command and continue... ')
try:
xts_alias.run_alias_builtin(['--remove', alias_name])
except Exception as e:
error(f'Failed to remove demo alias: {e}')

print()
info('Demo finished. You can now add your own aliases with xts --alias --add <path> --name <alias>.')
Comment on lines +123 to +130
assert 'Command: xts demo-example run hello_world' in output
assert 'Section 5: Remove the demo alias.' in output
assert 'Command: xts --alias --remove demo-example' in output
assert 'Section 6: Refresh the demo alias.' in output
assert 'Command: xts --alias --refresh demo-example' in output
assert 'demo-example ->' in output
assert 'Removed alias: demo-example' in output
assert 'Demo finished. You can now add your own aliases' in output
Comment thread README.md
Comment on lines +132 to +139
A new interactive demo command is available to guide first-time users through alias setup and execution:

```sh
xts demo
```

It will add a sample alias from `examples/hello_world.xts`, list the alias, and execute the example `hello_world` command.

@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/xts_core/72/rdkcentral/xts_core

  • Commit: 6c24028

Report detail: gist'

@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## WARNING: A Blackduck scan failure has been waived

A prior failure has been upvoted

  • Upvote reason: OK

  • Commit: 6c24028
    '

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: xts demo

3 participants