kctl-react 0.6.2__py3-none-any.whl

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.
Files changed (102) hide show
  1. kctl_react/__init__.py +3 -0
  2. kctl_react/__main__.py +5 -0
  3. kctl_react/cli.py +201 -0
  4. kctl_react/commands/__init__.py +0 -0
  5. kctl_react/commands/a11y.py +78 -0
  6. kctl_react/commands/affected.py +170 -0
  7. kctl_react/commands/apps.py +353 -0
  8. kctl_react/commands/build.py +376 -0
  9. kctl_react/commands/bundle_cmd.py +217 -0
  10. kctl_react/commands/cap.py +1465 -0
  11. kctl_react/commands/clean.py +76 -0
  12. kctl_react/commands/codegen.py +491 -0
  13. kctl_react/commands/compliance.py +587 -0
  14. kctl_react/commands/config_cmd.py +368 -0
  15. kctl_react/commands/dashboard.py +163 -0
  16. kctl_react/commands/deploy.py +318 -0
  17. kctl_react/commands/deps.py +792 -0
  18. kctl_react/commands/dev.py +96 -0
  19. kctl_react/commands/docker_cmd.py +73 -0
  20. kctl_react/commands/doctor.py +170 -0
  21. kctl_react/commands/e2e.py +343 -0
  22. kctl_react/commands/env.py +155 -0
  23. kctl_react/commands/i18n.py +310 -0
  24. kctl_react/commands/lint.py +306 -0
  25. kctl_react/commands/maintenance.py +308 -0
  26. kctl_react/commands/monitor_cmd.py +50 -0
  27. kctl_react/commands/observe.py +34 -0
  28. kctl_react/commands/packages.py +129 -0
  29. kctl_react/commands/perf.py +762 -0
  30. kctl_react/commands/pipeline.py +289 -0
  31. kctl_react/commands/pwa.py +193 -0
  32. kctl_react/commands/scaffold.py +323 -0
  33. kctl_react/commands/security.py +660 -0
  34. kctl_react/commands/skill_cmd.py +54 -0
  35. kctl_react/commands/state.py +254 -0
  36. kctl_react/commands/test_cmd.py +418 -0
  37. kctl_react/commands/ui_audit.py +889 -0
  38. kctl_react/core/__init__.py +0 -0
  39. kctl_react/core/analyzers.py +200 -0
  40. kctl_react/core/callbacks.py +70 -0
  41. kctl_react/core/compliance/__init__.py +3 -0
  42. kctl_react/core/compliance/api_check/__init__.py +3 -0
  43. kctl_react/core/compliance/api_check/checks/__init__.py +18 -0
  44. kctl_react/core/compliance/api_check/checks/endpoints.py +53 -0
  45. kctl_react/core/compliance/api_check/checks/envelope.py +44 -0
  46. kctl_react/core/compliance/api_check/checks/naming.py +60 -0
  47. kctl_react/core/compliance/api_check/checks/params.py +44 -0
  48. kctl_react/core/compliance/api_check/checks/requests.py +57 -0
  49. kctl_react/core/compliance/api_check/checks/types.py +55 -0
  50. kctl_react/core/compliance/api_check/hooks.py +133 -0
  51. kctl_react/core/compliance/api_check/matcher.py +55 -0
  52. kctl_react/core/compliance/api_check/schema.py +151 -0
  53. kctl_react/core/compliance/api_health/__init__.py +35 -0
  54. kctl_react/core/compliance/api_health/checks/__init__.py +9 -0
  55. kctl_react/core/compliance/api_health/checks/auth.py +72 -0
  56. kctl_react/core/compliance/api_health/checks/reachable.py +44 -0
  57. kctl_react/core/compliance/api_health/checks/response.py +55 -0
  58. kctl_react/core/compliance/api_health/checks/timing.py +38 -0
  59. kctl_react/core/compliance/api_health/client.py +99 -0
  60. kctl_react/core/compliance/api_health/sampler.py +16 -0
  61. kctl_react/core/compliance/checks/__init__.py +47 -0
  62. kctl_react/core/compliance/checks/api.py +101 -0
  63. kctl_react/core/compliance/checks/codegen.py +94 -0
  64. kctl_react/core/compliance/checks/darkmode.py +57 -0
  65. kctl_react/core/compliance/checks/errors.py +68 -0
  66. kctl_react/core/compliance/checks/features.py +66 -0
  67. kctl_react/core/compliance/checks/i18n_check.py +105 -0
  68. kctl_react/core/compliance/checks/imports.py +86 -0
  69. kctl_react/core/compliance/checks/navigation.py +62 -0
  70. kctl_react/core/compliance/checks/practices.py +122 -0
  71. kctl_react/core/compliance/checks/providers.py +85 -0
  72. kctl_react/core/compliance/checks/pwa.py +101 -0
  73. kctl_react/core/compliance/checks/responsive.py +47 -0
  74. kctl_react/core/compliance/checks/scripts.py +85 -0
  75. kctl_react/core/compliance/checks/shadcn.py +51 -0
  76. kctl_react/core/compliance/checks/structure.py +76 -0
  77. kctl_react/core/compliance/checks/testing.py +83 -0
  78. kctl_react/core/compliance/checks/theme.py +92 -0
  79. kctl_react/core/compliance/checks/ui_standard.py +185 -0
  80. kctl_react/core/compliance/checks/vite.py +83 -0
  81. kctl_react/core/compliance/engine.py +87 -0
  82. kctl_react/core/compliance/exceptions_map.py +15 -0
  83. kctl_react/core/compliance/fixes/__init__.py +33 -0
  84. kctl_react/core/compliance/fixes/codegen_fix.py +28 -0
  85. kctl_react/core/compliance/fixes/i18n_fix.py +61 -0
  86. kctl_react/core/compliance/fixes/imports_fix.py +36 -0
  87. kctl_react/core/compliance/fixes/structure_fix.py +20 -0
  88. kctl_react/core/compliance/fixes/theme_fix.py +29 -0
  89. kctl_react/core/compliance/models.py +106 -0
  90. kctl_react/core/config.py +201 -0
  91. kctl_react/core/discovery.py +185 -0
  92. kctl_react/core/exceptions.py +17 -0
  93. kctl_react/core/git.py +146 -0
  94. kctl_react/core/history.py +121 -0
  95. kctl_react/core/output.py +5 -0
  96. kctl_react/core/plugins.py +13 -0
  97. kctl_react/core/runner.py +34 -0
  98. kctl_react/py.typed +0 -0
  99. kctl_react-0.6.2.dist-info/METADATA +17 -0
  100. kctl_react-0.6.2.dist-info/RECORD +102 -0
  101. kctl_react-0.6.2.dist-info/WHEEL +4 -0
  102. kctl_react-0.6.2.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,129 @@
1
+ """Shared package management commands."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import contextlib
6
+ import json
7
+ from typing import Annotated
8
+
9
+ import typer
10
+
11
+ from kctl_react.core.callbacks import AppContext
12
+ from kctl_react.core.discovery import get_app_dir
13
+
14
+ app = typer.Typer(help="Shared package inspection and management.")
15
+
16
+
17
+ @app.command("list")
18
+ def list_(ctx: typer.Context) -> None:
19
+ """List all shared packages with versions and descriptions."""
20
+ actx: AppContext = ctx.obj
21
+ out = actx.output
22
+ root = actx.project_root
23
+
24
+ rows: list[list[str]] = []
25
+ json_data: list[dict] = []
26
+
27
+ packages_dir = root / "packages"
28
+ for pkg_name in sorted(actx.packages):
29
+ pkg_dir = packages_dir / pkg_name
30
+ pkg_file = pkg_dir / "package.json"
31
+
32
+ if not pkg_file.exists():
33
+ rows.append([f"@kodemeio/{pkg_name}", "[dim]--[/dim]", "[red]missing[/red]", ""])
34
+ continue
35
+
36
+ pkg = json.loads(pkg_file.read_text())
37
+ version = pkg.get("version", "0.0.0")
38
+ description = pkg.get("description", "")
39
+
40
+ # Count exports
41
+ src_dir = pkg_dir / "src"
42
+ ts_files = len(list(src_dir.rglob("*.ts"))) + len(list(src_dir.rglob("*.tsx"))) if src_dir.is_dir() else 0
43
+
44
+ rows.append([f"@kodemeio/{pkg_name}", version, str(ts_files), description[:50]])
45
+ json_data.append(
46
+ {
47
+ "package": f"@kodemeio/{pkg_name}",
48
+ "version": version,
49
+ "files": ts_files,
50
+ "description": description,
51
+ }
52
+ )
53
+
54
+ out.table(
55
+ "Shared Packages",
56
+ [("Package", "cyan"), ("Version", "green"), ("Files", ""), ("Description", "dim")],
57
+ rows,
58
+ data_for_json=json_data,
59
+ )
60
+
61
+
62
+ @app.command()
63
+ def consumers(
64
+ ctx: typer.Context,
65
+ package_name: Annotated[str, typer.Argument(help="Package name (e.g. core, ui, offline)")],
66
+ ) -> None:
67
+ """Show which apps use a specific shared package."""
68
+ actx: AppContext = ctx.obj
69
+ out = actx.output
70
+ root = actx.project_root
71
+
72
+ full_name = f"@kodemeio/{package_name}"
73
+
74
+ rows: list[list[str]] = []
75
+ json_data: list[dict] = []
76
+
77
+ for app_name in actx.app_names:
78
+ pkg_file = get_app_dir(root, app_name) / "package.json"
79
+ if not pkg_file.exists():
80
+ continue
81
+
82
+ pkg = json.loads(pkg_file.read_text())
83
+ all_deps = {**pkg.get("dependencies", {}), **pkg.get("devDependencies", {})}
84
+
85
+ if full_name in all_deps:
86
+ version = all_deps[full_name]
87
+ rows.append([app_name, "[green]Yes[/green]", version])
88
+ json_data.append({"app": app_name, "uses": True, "version": version})
89
+ else:
90
+ rows.append([app_name, "[dim]No[/dim]", ""])
91
+ json_data.append({"app": app_name, "uses": False})
92
+
93
+ out.table(
94
+ f"Consumers of {full_name}",
95
+ [("App", "cyan"), ("Uses", ""), ("Version", "dim")],
96
+ rows,
97
+ data_for_json=json_data,
98
+ )
99
+
100
+
101
+ @app.command()
102
+ def size(ctx: typer.Context) -> None:
103
+ """Show source size of each shared package."""
104
+ actx: AppContext = ctx.obj
105
+ out = actx.output
106
+ root = actx.project_root
107
+
108
+ rows: list[list[str]] = []
109
+ packages_dir = root / "packages"
110
+
111
+ for pkg_name in sorted(actx.packages):
112
+ src_dir = packages_dir / pkg_name / "src"
113
+ if not src_dir.is_dir():
114
+ rows.append([f"@kodemeio/{pkg_name}", "[dim]--[/dim]", "[dim]--[/dim]"])
115
+ continue
116
+
117
+ files = list(src_dir.rglob("*.ts")) + list(src_dir.rglob("*.tsx"))
118
+ total_lines = 0
119
+ for f in files:
120
+ with contextlib.suppress(Exception):
121
+ total_lines += len(f.read_text().splitlines())
122
+
123
+ rows.append([f"@kodemeio/{pkg_name}", str(len(files)), f"{total_lines:,} lines"])
124
+
125
+ out.table(
126
+ "Package Source Sizes",
127
+ [("Package", "cyan"), ("Files", "green"), ("Lines", "")],
128
+ rows,
129
+ )