chatup 0.1.0__tar.gz → 0.2.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.
- {chatup-0.1.0/src/chatup.egg-info → chatup-0.2.0}/PKG-INFO +7 -5
- {chatup-0.1.0 → chatup-0.2.0}/README.md +1 -1
- {chatup-0.1.0 → chatup-0.2.0}/pyproject.toml +18 -3
- {chatup-0.1.0 → chatup-0.2.0}/src/chatup/__init__.py +1 -1
- {chatup-0.1.0 → chatup-0.2.0}/src/chatup/cli.py +5 -1
- chatup-0.2.0/src/chatup/const.py +35 -0
- chatup-0.2.0/src/chatup/interaction/__init__.py +64 -0
- chatup-0.2.0/src/chatup/interaction/command_schema.py +62 -0
- chatup-0.2.0/src/chatup/interaction/policy.py +49 -0
- chatup-0.2.0/src/chatup/interaction/warnings.py +24 -0
- chatup-0.2.0/src/chatup/setup/__init__.py +0 -0
- chatup-0.2.0/src/chatup/setup/assets/hermes/install.sh +2837 -0
- chatup-0.2.0/src/chatup/setup/assets/nvm.sh +4285 -0
- chatup-0.2.0/src/chatup/setup/cc_connect.py +63 -0
- chatup-0.2.0/src/chatup/setup/chrome.py +188 -0
- chatup-0.2.0/src/chatup/setup/claude.py +239 -0
- chatup-0.2.0/src/chatup/setup/cli.py +17 -0
- chatup-0.2.0/src/chatup/setup/codex.py +454 -0
- chatup-0.2.0/src/chatup/setup/docker.py +160 -0
- chatup-0.2.0/src/chatup/setup/elements.py +702 -0
- chatup-0.2.0/src/chatup/setup/frp.py +290 -0
- chatup-0.2.0/src/chatup/setup/hermes.py +549 -0
- chatup-0.2.0/src/chatup/setup/lark_cli.py +425 -0
- chatup-0.2.0/src/chatup/setup/mode_prompt.py +22 -0
- chatup-0.2.0/src/chatup/setup/nodejs.py +438 -0
- chatup-0.2.0/src/chatup/setup/opencode.py +428 -0
- chatup-0.2.0/src/chatup/setup/shell_rc.py +74 -0
- chatup-0.2.0/src/chatup/setup/workspace/__init__.py +3 -0
- chatup-0.2.0/src/chatup/setup/workspace/cli.py +246 -0
- chatup-0.2.0/src/chatup/setup/workspace/core.py +77 -0
- chatup-0.2.0/src/chatup/setup/workspace/options.py +232 -0
- chatup-0.2.0/src/chatup/setup/workspace/render.py +170 -0
- chatup-0.2.0/src/chatup/setup/workspace/templates/default/en/AGENTS.md +80 -0
- chatup-0.2.0/src/chatup/setup/workspace/templates/default/en/projects/README.md +113 -0
- chatup-0.2.0/src/chatup/setup/workspace/templates/default/zh/AGENTS.md +80 -0
- chatup-0.2.0/src/chatup/setup/workspace/templates/default/zh/projects/README.md +121 -0
- chatup-0.2.0/src/chatup/setup/workspace.py +3 -0
- chatup-0.2.0/src/chatup/setup/zsh.py +428 -0
- chatup-0.2.0/src/chatup/utils/__init__.py +0 -0
- chatup-0.2.0/src/chatup/utils/custom_logger.py +110 -0
- chatup-0.2.0/src/chatup/utils/pathing.py +40 -0
- {chatup-0.1.0 → chatup-0.2.0/src/chatup.egg-info}/PKG-INFO +7 -5
- chatup-0.2.0/src/chatup.egg-info/SOURCES.txt +51 -0
- chatup-0.2.0/src/chatup.egg-info/requires.txt +4 -0
- chatup-0.2.0/tests/test_pyproject_metadata.py +46 -0
- chatup-0.2.0/tests/test_setup_cli.py +104 -0
- {chatup-0.1.0 → chatup-0.2.0}/tests/test_version.py +2 -2
- chatup-0.2.0/tests/test_workspace_setup.py +102 -0
- chatup-0.1.0/src/chatup.egg-info/SOURCES.txt +0 -12
- chatup-0.1.0/src/chatup.egg-info/requires.txt +0 -2
- {chatup-0.1.0 → chatup-0.2.0}/LICENSE +0 -0
- {chatup-0.1.0 → chatup-0.2.0}/setup.cfg +0 -0
- {chatup-0.1.0 → chatup-0.2.0}/src/chatup.egg-info/dependency_links.txt +0 -0
- {chatup-0.1.0 → chatup-0.2.0}/src/chatup.egg-info/entry_points.txt +0 -0
- {chatup-0.1.0 → chatup-0.2.0}/src/chatup.egg-info/top_level.txt +0 -0
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chatup
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: ChatArch setup CLI extracted from ChatTool
|
|
5
5
|
Author-email: rexwzh <1073853456@qq.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
|
-
Keywords: chatup,cli
|
|
7
|
+
Keywords: chatup,chatarch,setup,cli
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Requires-Python: >=3.9
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
13
|
Requires-Dist: click>=8.0
|
|
14
|
-
Requires-Dist: chatstyle
|
|
14
|
+
Requires-Dist: chatstyle<0.2.0,>=0.1.0
|
|
15
|
+
Requires-Dist: chatenv<0.3.0,>=0.2.0
|
|
16
|
+
Requires-Dist: colorama
|
|
15
17
|
Dynamic: license-file
|
|
16
18
|
|
|
17
19
|
# chatup
|
|
18
20
|
|
|
19
|
-
ChatUp is the standalone ChatArch setup CLI. It
|
|
21
|
+
ChatUp is the standalone ChatArch setup CLI. It is the first-level replacement for `chattool setup`: commands such as `chattool setup workspace` become `chatup workspace` while preserving the same interactive/non-interactive CLI conventions.
|
|
20
22
|
|
|
21
23
|
## Quick Start
|
|
22
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# chatup
|
|
2
2
|
|
|
3
|
-
ChatUp is the standalone ChatArch setup CLI. It
|
|
3
|
+
ChatUp is the standalone ChatArch setup CLI. It is the first-level replacement for `chattool setup`: commands such as `chattool setup workspace` become `chatup workspace` while preserving the same interactive/non-interactive CLI conventions.
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
@@ -5,13 +5,18 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "chatup"
|
|
7
7
|
dynamic = ["version"]
|
|
8
|
-
description = "
|
|
8
|
+
description = "ChatArch setup CLI extracted from ChatTool"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
11
11
|
license = "MIT"
|
|
12
|
-
dependencies = [
|
|
12
|
+
dependencies = [
|
|
13
|
+
"click>=8.0",
|
|
14
|
+
"chatstyle>=0.1.0,<0.2.0",
|
|
15
|
+
"chatenv>=0.2.0,<0.3.0",
|
|
16
|
+
"colorama",
|
|
17
|
+
]
|
|
13
18
|
authors = [{name = "rexwzh", email = "1073853456@qq.com"}]
|
|
14
|
-
keywords = ["chatup", "cli"]
|
|
19
|
+
keywords = ["chatup", "chatarch", "setup", "cli"]
|
|
15
20
|
classifiers = [
|
|
16
21
|
"Programming Language :: Python :: 3",
|
|
17
22
|
"Operating System :: OS Independent",
|
|
@@ -28,3 +33,13 @@ where = ["src"]
|
|
|
28
33
|
|
|
29
34
|
[tool.setuptools]
|
|
30
35
|
include-package-data = true
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.package-data]
|
|
38
|
+
"chatup.setup" = [
|
|
39
|
+
"assets/*.sh",
|
|
40
|
+
"assets/hermes/*.sh",
|
|
41
|
+
"workspace/templates/default/zh/*.md",
|
|
42
|
+
"workspace/templates/default/zh/projects/*.md",
|
|
43
|
+
"workspace/templates/default/en/*.md",
|
|
44
|
+
"workspace/templates/default/en/projects/*.md",
|
|
45
|
+
]
|
|
@@ -3,12 +3,13 @@ from __future__ import annotations
|
|
|
3
3
|
import click
|
|
4
4
|
|
|
5
5
|
from chatup import __version__
|
|
6
|
+
from chatup.setup.cli import register_setup_commands
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
@click.group(context_settings={"help_option_names": ["-h", "--help"]})
|
|
9
10
|
@click.version_option(__version__, prog_name="chatup")
|
|
10
11
|
def main() -> None:
|
|
11
|
-
"""ChatUp CLI for ChatArch
|
|
12
|
+
"""ChatUp CLI for ChatArch bootstrap workflows."""
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
@main.command(name="doctor")
|
|
@@ -17,5 +18,8 @@ def doctor() -> None:
|
|
|
17
18
|
click.echo(f"chatup {__version__} ok")
|
|
18
19
|
|
|
19
20
|
|
|
21
|
+
register_setup_commands(main)
|
|
22
|
+
|
|
23
|
+
|
|
20
24
|
if __name__ == "__main__":
|
|
21
25
|
main()
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from chatenv.configs import OpenAIConfig
|
|
4
|
+
from chatenv.fields import BaseEnvConfig
|
|
5
|
+
from chatenv.paths import get_paths
|
|
6
|
+
|
|
7
|
+
# ChatTool 7.0.0 uses the ChatArch env root directly. Old platformdirs based
|
|
8
|
+
# paths are intentionally not used as fallback.
|
|
9
|
+
CHATARCH_PATHS = get_paths()
|
|
10
|
+
CHATARCH_HOME = CHATARCH_PATHS.home_dir
|
|
11
|
+
CHATARCH_ENV_DIR = CHATARCH_PATHS.envs_dir
|
|
12
|
+
CHATARCH_ENV_FILE = CHATARCH_ENV_DIR / ".env"
|
|
13
|
+
CHATARCH_CACHE_DIR = CHATARCH_HOME / "cache" / "chatup"
|
|
14
|
+
CHATARCH_CONFIG_DIR = CHATARCH_HOME / "config" / "chatup"
|
|
15
|
+
CHATTOOL_REPO_DIR = Path(__file__).parent.parent.parent
|
|
16
|
+
|
|
17
|
+
CHATARCH_ENV_DIR.mkdir(parents=True, exist_ok=True)
|
|
18
|
+
CHATARCH_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
|
19
|
+
|
|
20
|
+
# setup environment variables
|
|
21
|
+
# explicit args > environment > typed env files > default values
|
|
22
|
+
BaseEnvConfig.load_all(CHATARCH_ENV_DIR)
|
|
23
|
+
|
|
24
|
+
# Inject loaded values into current namespace for setup modules that read constants.
|
|
25
|
+
globals().update(BaseEnvConfig.get_all_values())
|
|
26
|
+
|
|
27
|
+
_api_base = globals().get("OPENAI_API_BASE")
|
|
28
|
+
|
|
29
|
+
# Final fallback
|
|
30
|
+
if not _api_base:
|
|
31
|
+
_api_base = "https://api.openai.com/v1"
|
|
32
|
+
|
|
33
|
+
OPENAI_API_BASE = _api_base
|
|
34
|
+
# Update the config object as well, just in case
|
|
35
|
+
OpenAIConfig.OPENAI_API_BASE.value = _api_base
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Shared CLI interaction helpers."""
|
|
2
|
+
|
|
3
|
+
from chatstyle import (
|
|
4
|
+
BACK_VALUE,
|
|
5
|
+
CHECKBOX_SELECTED_INDICATOR,
|
|
6
|
+
CHECKBOX_UNSELECTED_INDICATOR,
|
|
7
|
+
ask_checkbox,
|
|
8
|
+
ask_checkbox_with_controls,
|
|
9
|
+
ask_confirm,
|
|
10
|
+
ask_path,
|
|
11
|
+
ask_select,
|
|
12
|
+
ask_text,
|
|
13
|
+
create_choice,
|
|
14
|
+
get_separator,
|
|
15
|
+
get_style,
|
|
16
|
+
is_interactive_available,
|
|
17
|
+
prompt_sensitive_value,
|
|
18
|
+
prompt_text_value,
|
|
19
|
+
resolve_value,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
from .command_schema import (
|
|
23
|
+
CommandConstraint,
|
|
24
|
+
CommandField,
|
|
25
|
+
CommandSchema,
|
|
26
|
+
add_interactive_option,
|
|
27
|
+
resolve_command_inputs,
|
|
28
|
+
)
|
|
29
|
+
from .policy import (
|
|
30
|
+
abort_if_force_without_tty,
|
|
31
|
+
abort_if_missing_without_tty,
|
|
32
|
+
normalize_interactive,
|
|
33
|
+
resolve_interactive_mode,
|
|
34
|
+
)
|
|
35
|
+
from .warnings import install_cli_warning_filters
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"BACK_VALUE",
|
|
39
|
+
"CHECKBOX_SELECTED_INDICATOR",
|
|
40
|
+
"CHECKBOX_UNSELECTED_INDICATOR",
|
|
41
|
+
"CommandConstraint",
|
|
42
|
+
"CommandField",
|
|
43
|
+
"CommandSchema",
|
|
44
|
+
"add_interactive_option",
|
|
45
|
+
"abort_if_force_without_tty",
|
|
46
|
+
"abort_if_missing_without_tty",
|
|
47
|
+
"ask_checkbox",
|
|
48
|
+
"ask_checkbox_with_controls",
|
|
49
|
+
"ask_confirm",
|
|
50
|
+
"ask_path",
|
|
51
|
+
"ask_select",
|
|
52
|
+
"ask_text",
|
|
53
|
+
"create_choice",
|
|
54
|
+
"get_separator",
|
|
55
|
+
"get_style",
|
|
56
|
+
"install_cli_warning_filters",
|
|
57
|
+
"is_interactive_available",
|
|
58
|
+
"normalize_interactive",
|
|
59
|
+
"prompt_sensitive_value",
|
|
60
|
+
"prompt_text_value",
|
|
61
|
+
"resolve_command_inputs",
|
|
62
|
+
"resolve_interactive_mode",
|
|
63
|
+
"resolve_value",
|
|
64
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""ChatTool policy adapter for external :mod:`chatstyle` command schemas."""
|
|
2
|
+
|
|
3
|
+
from chatstyle import (
|
|
4
|
+
CommandConstraint,
|
|
5
|
+
CommandField,
|
|
6
|
+
CommandSchema,
|
|
7
|
+
InteractiveResolution,
|
|
8
|
+
add_interactive_option,
|
|
9
|
+
)
|
|
10
|
+
from chatstyle import resolve_command_inputs as _resolve_command_inputs
|
|
11
|
+
from chatstyle.tui.prompt import ask_confirm, ask_path, ask_select, ask_text
|
|
12
|
+
|
|
13
|
+
from .policy import resolve_interactive_mode
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def resolve_command_inputs(*, schema, provided, interactive, usage):
|
|
17
|
+
"""Resolve command inputs through ChatStyle while preserving old patch points."""
|
|
18
|
+
|
|
19
|
+
return _resolve_command_inputs(
|
|
20
|
+
schema=schema,
|
|
21
|
+
provided=provided,
|
|
22
|
+
interactive=interactive,
|
|
23
|
+
usage=usage,
|
|
24
|
+
prompt_runtime_override=_PromptRuntime,
|
|
25
|
+
interactive_resolver_override=_resolve_interactive_for_chatstyle,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class _PromptRuntime:
|
|
30
|
+
ask_confirm = staticmethod(lambda *args, **kwargs: ask_confirm(*args, **kwargs))
|
|
31
|
+
ask_path = staticmethod(lambda *args, **kwargs: ask_path(*args, **kwargs))
|
|
32
|
+
ask_select = staticmethod(lambda *args, **kwargs: ask_select(*args, **kwargs))
|
|
33
|
+
ask_text = staticmethod(lambda *args, **kwargs: ask_text(*args, **kwargs))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _resolve_interactive_for_chatstyle(*, interactive, auto_prompt_condition):
|
|
37
|
+
(
|
|
38
|
+
normalized,
|
|
39
|
+
can_prompt,
|
|
40
|
+
force_interactive,
|
|
41
|
+
_auto_interactive,
|
|
42
|
+
need_prompt,
|
|
43
|
+
) = resolve_interactive_mode(interactive, auto_prompt_condition)
|
|
44
|
+
return InteractiveResolution(
|
|
45
|
+
interactive=normalized,
|
|
46
|
+
can_prompt=can_prompt,
|
|
47
|
+
force_interactive=force_interactive,
|
|
48
|
+
need_prompt=need_prompt,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
__all__ = [
|
|
52
|
+
"CommandConstraint",
|
|
53
|
+
"CommandField",
|
|
54
|
+
"CommandSchema",
|
|
55
|
+
"InteractiveResolution",
|
|
56
|
+
"add_interactive_option",
|
|
57
|
+
"ask_confirm",
|
|
58
|
+
"ask_path",
|
|
59
|
+
"ask_select",
|
|
60
|
+
"ask_text",
|
|
61
|
+
"resolve_command_inputs",
|
|
62
|
+
]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Interactive policy helpers shared across CLI commands."""
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from chatstyle import FORCE_INTERACTIVE_NO_TTY_MESSAGE
|
|
6
|
+
from chatstyle import is_interactive_available as _is_interactive_available
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def is_interactive_available():
|
|
10
|
+
return _is_interactive_available()
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def normalize_interactive(interactive):
|
|
14
|
+
ctx = click.get_current_context(silent=True)
|
|
15
|
+
if ctx:
|
|
16
|
+
try:
|
|
17
|
+
if (
|
|
18
|
+
ctx.get_parameter_source("interactive")
|
|
19
|
+
== click.core.ParameterSource.DEFAULT
|
|
20
|
+
):
|
|
21
|
+
return None
|
|
22
|
+
except Exception:
|
|
23
|
+
pass
|
|
24
|
+
return interactive
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def resolve_interactive_mode(interactive, auto_prompt_condition):
|
|
28
|
+
interactive = normalize_interactive(interactive)
|
|
29
|
+
can_prompt = is_interactive_available()
|
|
30
|
+
force_interactive = interactive is True
|
|
31
|
+
auto_interactive = interactive is None and can_prompt and auto_prompt_condition
|
|
32
|
+
need_prompt = force_interactive or auto_interactive
|
|
33
|
+
return interactive, can_prompt, force_interactive, auto_interactive, need_prompt
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def abort_if_force_without_tty(force_interactive, can_prompt, usage):
|
|
37
|
+
if force_interactive and not can_prompt:
|
|
38
|
+
click.echo(FORCE_INTERACTIVE_NO_TTY_MESSAGE, err=True)
|
|
39
|
+
click.echo(usage, err=True)
|
|
40
|
+
raise click.Abort()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def abort_if_missing_without_tty(
|
|
44
|
+
missing_required, interactive, can_prompt, message, usage
|
|
45
|
+
):
|
|
46
|
+
if missing_required and interactive is None and not can_prompt:
|
|
47
|
+
click.echo(message, err=True)
|
|
48
|
+
click.echo(usage, err=True)
|
|
49
|
+
raise click.Abort()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Warning filters for ChatTool CLI entrypoints."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import warnings
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def install_cli_warning_filters() -> None:
|
|
9
|
+
"""Hide noisy third-party warnings that do not affect CLI behavior."""
|
|
10
|
+
warnings.filterwarnings(
|
|
11
|
+
"ignore",
|
|
12
|
+
message="pkg_resources is deprecated as an API.*",
|
|
13
|
+
category=UserWarning,
|
|
14
|
+
)
|
|
15
|
+
warnings.filterwarnings(
|
|
16
|
+
"ignore",
|
|
17
|
+
message=r"Deprecated call to `pkg_resources\.declare_namespace.*",
|
|
18
|
+
category=DeprecationWarning,
|
|
19
|
+
)
|
|
20
|
+
warnings.filterwarnings(
|
|
21
|
+
"ignore",
|
|
22
|
+
message="There is no current event loop",
|
|
23
|
+
category=DeprecationWarning,
|
|
24
|
+
)
|
|
File without changes
|