Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/benchmark_manifest_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"""

import os
import shutil
import sys
import tempfile
import time
import sys
import shutil
from pathlib import Path

# ---------------------------------------------------------------------------
Expand Down
7 changes: 5 additions & 2 deletions src/apm_cli/adapters/client/codex.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"""

import os
import toml
from pathlib import Path
from .base import MCPClientAdapter

import toml

from ...registry.client import SimpleRegistryClient
from ...registry.integration import RegistryIntegration
from .base import MCPClientAdapter


class CodexClientAdapter(MCPClientAdapter):
Expand Down Expand Up @@ -331,6 +333,7 @@ def _process_environment_variables(self, env_vars, env_overrides=None):
"""
import os
import sys

from rich.prompt import Prompt

resolved = {}
Expand Down
11 changes: 7 additions & 4 deletions src/apm_cli/adapters/client/copilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
import json
import os
from pathlib import Path
from .base import MCPClientAdapter
from ...registry.client import SimpleRegistryClient
from ...registry.integration import RegistryIntegration

from ...core.docker_args import DockerArgsProcessor
from ...core.token_manager import GitHubTokenManager
from ...registry.client import SimpleRegistryClient
from ...registry.integration import RegistryIntegration
from ...utils.github_host import is_github_hostname
from .base import MCPClientAdapter


class CopilotClientAdapter(MCPClientAdapter):
Expand Down Expand Up @@ -327,6 +328,7 @@ def _resolve_environment_variables(self, env_vars, env_overrides=None):
"""
import os
import sys

from rich.prompt import Prompt

resolved = {}
Expand Down Expand Up @@ -406,6 +408,7 @@ def _resolve_env_variable(self, name, value, env_overrides=None):
import os
import re
import sys

from rich.prompt import Prompt

env_overrides = env_overrides or {}
Expand Down Expand Up @@ -684,7 +687,7 @@ def _is_github_server(self, server_name, url):
bool: True if this is a legitimate GitHub MCP server, False otherwise.
"""
from urllib.parse import urlparse

# Check server name against an allowlist of known GitHub MCP servers
github_server_names = [
"github-mcp-server",
Expand Down
3 changes: 2 additions & 1 deletion src/apm_cli/adapters/client/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import json
import os
from pathlib import Path
from .base import MCPClientAdapter, _INPUT_VAR_RE

from ...registry.client import SimpleRegistryClient
from ...registry.integration import RegistryIntegration
from .base import _INPUT_VAR_RE, MCPClientAdapter


class VSCodeClientAdapter(MCPClientAdapter):
Expand Down
4 changes: 2 additions & 2 deletions src/apm_cli/adapters/package_manager/default_manager.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Implementation of the default MCP package manager."""

from .base import MCPPackageManagerAdapter
from ...config import get_default_client
from ...registry.integration import RegistryIntegration
from .base import MCPPackageManagerAdapter


class DefaultMCPPackageManager(MCPPackageManagerAdapter):
Expand Down Expand Up @@ -81,7 +81,7 @@ def list_installed(self):
try:
# Import here to avoid circular import
from ...factory import ClientFactory

# Get client type from configuration (default is vscode)
client_type = get_default_client()

Expand Down
4 changes: 2 additions & 2 deletions src/apm_cli/bundle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Bundle creation and consumption for APM packages."""

from .packer import pack_bundle, PackResult
from .packer import PackResult, pack_bundle
from .plugin_exporter import export_plugin_bundle
from .unpacker import unpack_bundle, UnpackResult
from .unpacker import UnpackResult, unpack_bundle

__all__ = [
"pack_bundle",
Expand Down
1 change: 0 additions & 1 deletion src/apm_cli/bundle/lockfile_enrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from ..deps.lockfile import LockFile


# Authoritative mapping of target names to deployed-file path prefixes.
_TARGET_PREFIXES = {
"copilot": [".github/"],
Expand Down
4 changes: 2 additions & 2 deletions src/apm_cli/bundle/packer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from pathlib import Path
from typing import Dict, List, Optional

from ..core.target_detection import detect_target
from ..deps.lockfile import LockFile, get_lockfile_path, migrate_lockfile_if_needed
from ..models.apm_package import APMPackage
from ..core.target_detection import detect_target
from .lockfile_enrichment import enrich_lockfile_for_pack, _filter_files_by_target
from .lockfile_enrichment import _filter_files_by_target, enrich_lockfile_for_pack


@dataclass
Expand Down
5 changes: 2 additions & 3 deletions src/apm_cli/bundle/plugin_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@

import json
import os
import re
import shutil
import tarfile
from pathlib import Path
from typing import Dict, List, Optional, Set, Tuple

import yaml

import re

from ..deps.lockfile import (
LockFile,
LockedDependency,
LockFile,
get_lockfile_path,
migrate_lockfile_if_needed,
)
Expand Down
2 changes: 1 addition & 1 deletion src/apm_cli/bundle/unpacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pathlib import Path
from typing import Dict, List

from ..deps.lockfile import LockFile, LOCKFILE_NAME, LEGACY_LOCKFILE_NAME
from ..deps.lockfile import LEGACY_LOCKFILE_NAME, LOCKFILE_NAME, LockFile


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions src/apm_cli/commands/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
GITIGNORE_FILENAME,
)
from ..utils.console import _rich_echo, _rich_info, _rich_warning
from ..version import get_build_sha, get_version
from ..utils.version_checker import check_for_updates
from ..version import get_build_sha, get_version

# CRITICAL: Shadow Click commands at module level to prevent namespace collision
# When Click commands like 'config set' are defined, calling set() can invoke the command
Expand Down Expand Up @@ -192,8 +192,8 @@ def _check_orphaned_packages():
return []

try:
from ..models.apm_package import APMPackage
from ..deps.lockfile import LockFile, get_lockfile_path
from ..models.apm_package import APMPackage

apm_package = APMPackage.from_apm_yml(Path(APM_YML_FILENAME))
declared_deps = apm_package.get_apm_dependencies()
Expand Down
6 changes: 3 additions & 3 deletions src/apm_cli/commands/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@

import click

from ..core.command_logger import CommandLogger
from ..deps.lockfile import LockFile, get_lockfile_path
from ..security.content_scanner import ContentScanner, ScanFinding
from ..security.file_scanner import scan_lockfile_packages
from ..core.command_logger import CommandLogger
from ..utils.console import (
STATUS_SYMBOLS,
_get_console,
_rich_echo,
_rich_error,
_rich_success,
_rich_warning,
STATUS_SYMBOLS,
)


# -- Helpers --------------------------------------------------------


Expand Down Expand Up @@ -89,6 +88,7 @@ def _render_findings_table(
if console:
try:
from rich.table import Table

from ..security.audit_report import relative_path_for_report

table = Table(
Expand Down
2 changes: 1 addition & 1 deletion src/apm_cli/commands/compile/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""APM compile command."""

from .cli import compile, _display_validation_errors, _get_validation_suggestion
from .cli import _display_validation_errors, _get_validation_suggestion, compile
from .watcher import _watch_mode

__all__ = [
Expand Down
3 changes: 2 additions & 1 deletion src/apm_cli/commands/compile/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import click

from ...constants import AGENTS_MD_FILENAME, APM_DIR, APM_MODULES_DIR, APM_YML_FILENAME
from ...compilation import AgentsCompiler, CompilationConfig
from ...constants import AGENTS_MD_FILENAME, APM_DIR, APM_MODULES_DIR, APM_YML_FILENAME
from ...core.command_logger import CommandLogger
from ...primitives.discovery import discover_primitives
from ...utils.console import (
Expand Down Expand Up @@ -35,6 +35,7 @@ def _display_single_file_summary(stats, c_status, c_hash, output_path, dry_run):
return

import os

from rich.table import Table

table = Table(
Expand Down
2 changes: 1 addition & 1 deletion src/apm_cli/commands/compile/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import time

from ...constants import AGENTS_MD_FILENAME, APM_DIR, APM_YML_FILENAME
from ...compilation import AgentsCompiler, CompilationConfig
from ...constants import AGENTS_MD_FILENAME, APM_DIR, APM_YML_FILENAME
from ...core.command_logger import CommandLogger


Expand Down
2 changes: 1 addition & 1 deletion src/apm_cli/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def get(key):
apm config get auto-integrate
apm config get
"""
from ..config import get_config, get_auto_integrate
from ..config import get_auto_integrate, get_config

logger = CommandLogger("config get")
if key:
Expand Down
10 changes: 5 additions & 5 deletions src/apm_cli/commands/deps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"""APM dependency management commands."""

from .cli import deps, list_packages, tree, clean, update, info
from ._utils import (
_is_nested_under_package,
_count_primitives,
_count_package_files,
_count_primitives,
_count_workflows,
_get_detailed_context_counts,
_get_package_display_info,
_get_detailed_package_info,
_update_single_package,
_get_package_display_info,
_is_nested_under_package,
_update_all_packages,
_update_single_package,
)
from .cli import clean, deps, info, list_packages, tree, update

__all__ = [
# CLI commands
Expand Down
2 changes: 1 addition & 1 deletion src/apm_cli/commands/deps/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from typing import Any, Dict, List, Optional

from ...constants import APM_DIR, APM_MODULES_DIR, APM_YML_FILENAME, SKILL_MD_FILENAME
from ...models.apm_package import APMPackage
from ...deps.github_downloader import GitHubPackageDownloader
from ...models.apm_package import APMPackage


def _scan_installed_packages(apm_modules_dir: Path) -> list:
Expand Down
29 changes: 15 additions & 14 deletions src/apm_cli/commands/deps/cli.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
"""APM dependency management CLI commands."""

import sys
import shutil
import click
import sys
from pathlib import Path
from typing import List, Optional, Dict, Any
from typing import Any, Dict, List, Optional

import click

# Import existing APM components
from ...constants import APM_DIR, APM_MODULES_DIR, APM_YML_FILENAME, SKILL_MD_FILENAME
from ...models.apm_package import APMPackage, ValidationResult, validate_apm_package
from ...core.command_logger import CommandLogger
from ...deps.apm_resolver import APMDependencyResolver

# Import APM dependency system components (with fallback)
from ...deps.github_downloader import GitHubPackageDownloader
from ...deps.apm_resolver import APMDependencyResolver

from ...models.apm_package import APMPackage, ValidationResult, validate_apm_package
from ._utils import (
_is_nested_under_package,
_count_primitives,
_count_package_files,
_count_primitives,
_count_workflows,
_get_detailed_context_counts,
_get_package_display_info,
_get_detailed_package_info,
_update_single_package,
_get_package_display_info,
_is_nested_under_package,
_update_all_packages,
_update_single_package,
)


Expand All @@ -41,9 +41,10 @@ def list_packages():

try:
# Import Rich components with fallback
from rich.table import Table
from rich.console import Console
import shutil

from rich.console import Console
from rich.table import Table
term_width = shutil.get_terminal_size((120, 24)).columns
console = Console(width=max(120, term_width))
has_rich = True
Expand Down Expand Up @@ -241,8 +242,8 @@ def tree():

try:
# Import Rich components with fallback
from rich.tree import Tree
from rich.console import Console
from rich.tree import Tree
console = Console()
has_rich = True
except ImportError:
Expand Down Expand Up @@ -533,8 +534,8 @@ def info(package: str):

# Display with Rich panel if available
try:
from rich.panel import Panel
from rich.console import Console
from rich.panel import Panel
from rich.text import Text
console = Console()

Expand Down
Loading
Loading