@vyuhlabs/dxkit 2.4.8 → 2.5.1

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 (319) hide show
  1. package/CHANGELOG.md +312 -0
  2. package/README.md +360 -439
  3. package/dist/analyzers/security/aggregator.d.ts.map +1 -1
  4. package/dist/analyzers/security/aggregator.js +4 -46
  5. package/dist/analyzers/security/aggregator.js.map +1 -1
  6. package/dist/analyzers/tools/fingerprint.d.ts +91 -26
  7. package/dist/analyzers/tools/fingerprint.d.ts.map +1 -1
  8. package/dist/analyzers/tools/fingerprint.js +111 -22
  9. package/dist/analyzers/tools/fingerprint.js.map +1 -1
  10. package/dist/analyzers/tools/generic.d.ts.map +1 -1
  11. package/dist/analyzers/tools/generic.js +6 -1
  12. package/dist/analyzers/tools/generic.js.map +1 -1
  13. package/dist/analyzers/tools/gitleaks.d.ts +24 -1
  14. package/dist/analyzers/tools/gitleaks.d.ts.map +1 -1
  15. package/dist/analyzers/tools/gitleaks.js +20 -11
  16. package/dist/analyzers/tools/gitleaks.js.map +1 -1
  17. package/dist/analyzers/tools/graphify.d.ts.map +1 -1
  18. package/dist/analyzers/tools/graphify.js +9 -5
  19. package/dist/analyzers/tools/graphify.js.map +1 -1
  20. package/dist/analyzers/tools/tool-registry.d.ts +19 -1
  21. package/dist/analyzers/tools/tool-registry.d.ts.map +1 -1
  22. package/dist/analyzers/tools/tool-registry.js +25 -0
  23. package/dist/analyzers/tools/tool-registry.js.map +1 -1
  24. package/dist/analyzers/types.d.ts +6 -4
  25. package/dist/analyzers/types.d.ts.map +1 -1
  26. package/dist/baseline/baseline-file.d.ts +104 -0
  27. package/dist/baseline/baseline-file.d.ts.map +1 -0
  28. package/dist/baseline/baseline-file.js +110 -0
  29. package/dist/baseline/baseline-file.js.map +1 -0
  30. package/dist/baseline/check-renderers.d.ts +108 -0
  31. package/dist/baseline/check-renderers.d.ts.map +1 -0
  32. package/dist/baseline/check-renderers.js +379 -0
  33. package/dist/baseline/check-renderers.js.map +1 -0
  34. package/dist/baseline/check.d.ts +127 -0
  35. package/dist/baseline/check.d.ts.map +1 -0
  36. package/dist/baseline/check.js +462 -0
  37. package/dist/baseline/check.js.map +1 -0
  38. package/dist/baseline/content-hash.d.ts +83 -0
  39. package/dist/baseline/content-hash.d.ts.map +1 -0
  40. package/dist/baseline/content-hash.js +131 -0
  41. package/dist/baseline/content-hash.js.map +1 -0
  42. package/dist/baseline/create.d.ts +96 -0
  43. package/dist/baseline/create.d.ts.map +1 -0
  44. package/dist/baseline/create.js +339 -0
  45. package/dist/baseline/create.js.map +1 -0
  46. package/dist/baseline/entry-to-located.d.ts +35 -0
  47. package/dist/baseline/entry-to-located.d.ts.map +1 -0
  48. package/dist/baseline/entry-to-located.js +72 -0
  49. package/dist/baseline/entry-to-located.js.map +1 -0
  50. package/dist/baseline/finding-identity.d.ts +47 -0
  51. package/dist/baseline/finding-identity.d.ts.map +1 -0
  52. package/dist/baseline/finding-identity.js +292 -0
  53. package/dist/baseline/finding-identity.js.map +1 -0
  54. package/dist/baseline/git-aware-match.d.ts +146 -0
  55. package/dist/baseline/git-aware-match.d.ts.map +1 -0
  56. package/dist/baseline/git-aware-match.js +439 -0
  57. package/dist/baseline/git-aware-match.js.map +1 -0
  58. package/dist/baseline/policy.d.ts +171 -0
  59. package/dist/baseline/policy.d.ts.map +1 -0
  60. package/dist/baseline/policy.js +206 -0
  61. package/dist/baseline/policy.js.map +1 -0
  62. package/dist/baseline/producers/health.d.ts +30 -0
  63. package/dist/baseline/producers/health.d.ts.map +1 -0
  64. package/dist/baseline/producers/health.js +42 -0
  65. package/dist/baseline/producers/health.js.map +1 -0
  66. package/dist/baseline/producers/index.d.ts +164 -0
  67. package/dist/baseline/producers/index.d.ts.map +1 -0
  68. package/dist/baseline/producers/index.js +200 -0
  69. package/dist/baseline/producers/index.js.map +1 -0
  70. package/dist/baseline/producers/licenses.d.ts +23 -0
  71. package/dist/baseline/producers/licenses.d.ts.map +1 -0
  72. package/dist/baseline/producers/licenses.js +46 -0
  73. package/dist/baseline/producers/licenses.js.map +1 -0
  74. package/dist/baseline/producers/quality.d.ts +39 -0
  75. package/dist/baseline/producers/quality.d.ts.map +1 -0
  76. package/dist/baseline/producers/quality.js +84 -0
  77. package/dist/baseline/producers/quality.js.map +1 -0
  78. package/dist/baseline/producers/secret-hmac.d.ts +45 -0
  79. package/dist/baseline/producers/secret-hmac.d.ts.map +1 -0
  80. package/dist/baseline/producers/secret-hmac.js +70 -0
  81. package/dist/baseline/producers/secret-hmac.js.map +1 -0
  82. package/dist/baseline/producers/security.d.ts +59 -0
  83. package/dist/baseline/producers/security.d.ts.map +1 -0
  84. package/dist/baseline/producers/security.js +135 -0
  85. package/dist/baseline/producers/security.js.map +1 -0
  86. package/dist/baseline/producers/tests.d.ts +36 -0
  87. package/dist/baseline/producers/tests.d.ts.map +1 -0
  88. package/dist/baseline/producers/tests.js +69 -0
  89. package/dist/baseline/producers/tests.js.map +1 -0
  90. package/dist/baseline/salt.d.ts +45 -0
  91. package/dist/baseline/salt.d.ts.map +1 -0
  92. package/dist/baseline/salt.js +113 -0
  93. package/dist/baseline/salt.js.map +1 -0
  94. package/dist/baseline/show.d.ts +79 -0
  95. package/dist/baseline/show.d.ts.map +1 -0
  96. package/dist/baseline/show.js +233 -0
  97. package/dist/baseline/show.js.map +1 -0
  98. package/dist/baseline/types.d.ts +482 -0
  99. package/dist/baseline/types.d.ts.map +1 -0
  100. package/dist/baseline/types.js +53 -0
  101. package/dist/baseline/types.js.map +1 -0
  102. package/dist/cli.d.ts.map +1 -1
  103. package/dist/cli.js +398 -82
  104. package/dist/cli.js.map +1 -1
  105. package/dist/constants.d.ts.map +1 -1
  106. package/dist/constants.js +0 -4
  107. package/dist/constants.js.map +1 -1
  108. package/dist/doctor.d.ts.map +1 -1
  109. package/dist/doctor.js +39 -35
  110. package/dist/doctor.js.map +1 -1
  111. package/dist/fail-on.d.ts +84 -0
  112. package/dist/fail-on.d.ts.map +1 -0
  113. package/dist/fail-on.js +128 -0
  114. package/dist/fail-on.js.map +1 -0
  115. package/dist/generator.d.ts +1 -1
  116. package/dist/generator.d.ts.map +1 -1
  117. package/dist/generator.js +81 -274
  118. package/dist/generator.js.map +1 -1
  119. package/dist/hooks-cli.d.ts +20 -0
  120. package/dist/hooks-cli.d.ts.map +1 -0
  121. package/dist/hooks-cli.js +145 -0
  122. package/dist/hooks-cli.js.map +1 -0
  123. package/dist/languages/csharp.d.ts.map +1 -1
  124. package/dist/languages/csharp.js +4 -9
  125. package/dist/languages/csharp.js.map +1 -1
  126. package/dist/languages/go.d.ts.map +1 -1
  127. package/dist/languages/go.js +3 -14
  128. package/dist/languages/go.js.map +1 -1
  129. package/dist/languages/index.d.ts +19 -1
  130. package/dist/languages/index.d.ts.map +1 -1
  131. package/dist/languages/index.js +32 -0
  132. package/dist/languages/index.js.map +1 -1
  133. package/dist/languages/java.d.ts.map +1 -1
  134. package/dist/languages/java.js +4 -6
  135. package/dist/languages/java.js.map +1 -1
  136. package/dist/languages/kotlin.d.ts.map +1 -1
  137. package/dist/languages/kotlin.js +9 -11
  138. package/dist/languages/kotlin.js.map +1 -1
  139. package/dist/languages/python.d.ts.map +1 -1
  140. package/dist/languages/python.js +4 -15
  141. package/dist/languages/python.js.map +1 -1
  142. package/dist/languages/ruby.d.ts.map +1 -1
  143. package/dist/languages/ruby.js +4 -6
  144. package/dist/languages/ruby.js.map +1 -1
  145. package/dist/languages/rust.d.ts.map +1 -1
  146. package/dist/languages/rust.js +4 -4
  147. package/dist/languages/rust.js.map +1 -1
  148. package/dist/languages/types.d.ts +29 -28
  149. package/dist/languages/types.d.ts.map +1 -1
  150. package/dist/languages/typescript.d.ts.map +1 -1
  151. package/dist/languages/typescript.js +31 -4
  152. package/dist/languages/typescript.js.map +1 -1
  153. package/dist/lib.d.ts +2 -3
  154. package/dist/lib.d.ts.map +1 -1
  155. package/dist/lib.js +3 -6
  156. package/dist/lib.js.map +1 -1
  157. package/dist/prompts.d.ts.map +1 -1
  158. package/dist/prompts.js +0 -10
  159. package/dist/prompts.js.map +1 -1
  160. package/dist/report-schema.d.ts +42 -0
  161. package/dist/report-schema.d.ts.map +1 -0
  162. package/dist/report-schema.js +54 -0
  163. package/dist/report-schema.js.map +1 -0
  164. package/dist/ship-installers.d.ts +112 -0
  165. package/dist/ship-installers.d.ts.map +1 -0
  166. package/dist/ship-installers.js +530 -0
  167. package/dist/ship-installers.js.map +1 -0
  168. package/dist/tools-cli.d.ts.map +1 -1
  169. package/dist/tools-cli.js +45 -9
  170. package/dist/tools-cli.js.map +1 -1
  171. package/dist/types.d.ts +0 -4
  172. package/dist/types.d.ts.map +1 -1
  173. package/dist/update.d.ts.map +1 -1
  174. package/dist/update.js +0 -4
  175. package/dist/update.js.map +1 -1
  176. package/package.json +17 -11
  177. package/templates/.claude/skills/dxkit-action/SKILL.md +150 -0
  178. package/templates/.claude/skills/dxkit-config/SKILL.md +124 -0
  179. package/templates/.claude/skills/dxkit-hooks/SKILL.md +109 -0
  180. package/templates/.claude/skills/dxkit-init/SKILL.md +93 -0
  181. package/templates/.claude/skills/dxkit-learn/SKILL.md +84 -0
  182. package/templates/.claude/skills/dxkit-reports/SKILL.md +111 -0
  183. package/templates/.devcontainer/devcontainer.json +55 -0
  184. package/templates/.devcontainer/install-agent-clis.sh +42 -0
  185. package/templates/.devcontainer/post-create.sh +81 -0
  186. package/templates/.githooks/pre-commit +55 -0
  187. package/templates/.githooks/pre-push +63 -0
  188. package/templates/.github/workflows/dxkit-baseline-refresh.yml +78 -0
  189. package/templates/.github/workflows/dxkit-guardrails.yml +98 -0
  190. package/templates/AGENTS.md.template +137 -0
  191. package/templates/CLAUDE.md.template +16 -245
  192. package/dist/codebase-scanner.d.ts +0 -36
  193. package/dist/codebase-scanner.d.ts.map +0 -1
  194. package/dist/codebase-scanner.js +0 -688
  195. package/dist/codebase-scanner.js.map +0 -1
  196. package/dist/project-yaml.d.ts +0 -13
  197. package/dist/project-yaml.d.ts.map +0 -1
  198. package/dist/project-yaml.js +0 -188
  199. package/dist/project-yaml.js.map +0 -1
  200. package/templates/.ai/README.md +0 -117
  201. package/templates/.ai/prompts/execution-prompt.md +0 -9
  202. package/templates/.ai/prompts/planning-prompt.md +0 -18
  203. package/templates/.ai/prompts/session-end-template.md +0 -182
  204. package/templates/.ai/prompts/session-end.md +0 -132
  205. package/templates/.ai/prompts/session-start.md +0 -109
  206. package/templates/.ai/prompts/step-by-step.md +0 -113
  207. package/templates/.ai/sessions/.gitkeep +0 -0
  208. package/templates/.claude/agents/doc-writer.md +0 -107
  209. package/templates/.claude/agents/knowledge-bot.md +0 -64
  210. package/templates/.claude/agents/onboarding.md +0 -61
  211. package/templates/.claude/agents/quality-reviewer.md +0 -85
  212. package/templates/.claude/agents-available/code-reviewer.md +0 -29
  213. package/templates/.claude/agents-available/codebase-explorer.md +0 -100
  214. package/templates/.claude/agents-available/dashboard-builder.md +0 -433
  215. package/templates/.claude/agents-available/debugger.md +0 -29
  216. package/templates/.claude/agents-available/dependency-mapper.md +0 -80
  217. package/templates/.claude/agents-available/dev-report.md +0 -108
  218. package/templates/.claude/agents-available/doc-writer.md +0 -107
  219. package/templates/.claude/agents-available/feature-builder.md +0 -163
  220. package/templates/.claude/agents-available/feature-planner.md +0 -185
  221. package/templates/.claude/agents-available/health-auditor.md +0 -95
  222. package/templates/.claude/agents-available/hooks-configurator.md +0 -211
  223. package/templates/.claude/agents-available/knowledge-bot.md +0 -62
  224. package/templates/.claude/agents-available/plan-executor.md +0 -133
  225. package/templates/.claude/agents-available/strategic-planner.md +0 -141
  226. package/templates/.claude/agents-available/test-gap-finder.md +0 -67
  227. package/templates/.claude/agents-available/test-writer.md +0 -34
  228. package/templates/.claude/agents-available/vulnerability-scanner.md +0 -173
  229. package/templates/.claude/commands/ask.md +0 -7
  230. package/templates/.claude/commands/build-feature.md +0 -26
  231. package/templates/.claude/commands/build.md.template +0 -30
  232. package/templates/.claude/commands/check.md.template +0 -43
  233. package/templates/.claude/commands/dashboard.md +0 -28
  234. package/templates/.claude/commands/deps.md +0 -15
  235. package/templates/.claude/commands/dev-report.md +0 -50
  236. package/templates/.claude/commands/docs.md +0 -21
  237. package/templates/.claude/commands/doctor.md +0 -21
  238. package/templates/.claude/commands/enable-agent.md +0 -12
  239. package/templates/.claude/commands/execute-plan.md +0 -25
  240. package/templates/.claude/commands/explore-codebase.md +0 -12
  241. package/templates/.claude/commands/export-pdf.md +0 -30
  242. package/templates/.claude/commands/feature.md +0 -25
  243. package/templates/.claude/commands/fix-issue.md +0 -12
  244. package/templates/.claude/commands/fix.md.template +0 -32
  245. package/templates/.claude/commands/health.md +0 -58
  246. package/templates/.claude/commands/help.md +0 -36
  247. package/templates/.claude/commands/learn.md +0 -48
  248. package/templates/.claude/commands/onboarding.md +0 -21
  249. package/templates/.claude/commands/plan.md +0 -20
  250. package/templates/.claude/commands/quality.md.template +0 -65
  251. package/templates/.claude/commands/session-end.md +0 -40
  252. package/templates/.claude/commands/session-start.md +0 -30
  253. package/templates/.claude/commands/setup-hooks.md +0 -18
  254. package/templates/.claude/commands/setup-pr-review.md +0 -72
  255. package/templates/.claude/commands/stealth-mode.md +0 -17
  256. package/templates/.claude/commands/test-gaps.md +0 -49
  257. package/templates/.claude/commands/test.md.template +0 -40
  258. package/templates/.claude/commands/vulnerabilities.md +0 -49
  259. package/templates/.claude/skills/build/SKILL.md.template +0 -98
  260. package/templates/.claude/skills/deploy/SKILL.md.template +0 -131
  261. package/templates/.claude/skills/deploy/references/gotchas.md +0 -5
  262. package/templates/.claude/skills/doctor/SKILL.md +0 -54
  263. package/templates/.claude/skills/gcloud/SKILL.md +0 -66
  264. package/templates/.claude/skills/gcloud/references/gotchas.md +0 -5
  265. package/templates/.claude/skills/learned/SKILL.md +0 -55
  266. package/templates/.claude/skills/learned/references/conventions.md +0 -11
  267. package/templates/.claude/skills/learned/references/deny-recommendations.md +0 -18
  268. package/templates/.claude/skills/learned/references/gotchas.md +0 -11
  269. package/templates/.claude/skills/pulumi/SKILL.md +0 -73
  270. package/templates/.claude/skills/quality/SKILL.md.template +0 -108
  271. package/templates/.claude/skills/quality/references/gotchas.md +0 -5
  272. package/templates/.claude/skills/review/SKILL.md.template +0 -73
  273. package/templates/.claude/skills/scaffold/SKILL.md.template +0 -123
  274. package/templates/.claude/skills/secrets/SKILL.md +0 -52
  275. package/templates/.claude/skills/session/SKILL.md +0 -43
  276. package/templates/.claude/skills/test/SKILL.md.template +0 -122
  277. package/templates/.claude/skills/test/references/gotchas.md +0 -5
  278. package/templates/.devcontainer/Dockerfile.dev.template +0 -89
  279. package/templates/.devcontainer/devcontainer.json.template +0 -184
  280. package/templates/.devcontainer/docker-compose.yml.template +0 -105
  281. package/templates/.devcontainer/init-scripts/01-init.sql.template +0 -12
  282. package/templates/.devcontainer/post-create.sh.template +0 -298
  283. package/templates/.github/workflows/ci.yml.template +0 -399
  284. package/templates/.github/workflows/quality.yml.template +0 -376
  285. package/templates/.pre-commit-config.yaml.template +0 -106
  286. package/templates/.project/config/edit_config.py +0 -275
  287. package/templates/.project/config/project_config.py +0 -894
  288. package/templates/.project/scripts/codegen/generate-all.sh +0 -20
  289. package/templates/.project/scripts/codegen/validate-all.sh +0 -17
  290. package/templates/.project/scripts/docs/generate-all.sh +0 -30
  291. package/templates/.project/scripts/docs/serve.sh +0 -20
  292. package/templates/.project/scripts/quality/fix-all.sh +0 -138
  293. package/templates/.project/scripts/quality/lint-go.sh +0 -34
  294. package/templates/.project/scripts/quality/lint-python.sh +0 -54
  295. package/templates/.project/scripts/quality/run-all.sh +0 -497
  296. package/templates/.project/scripts/session/commit.sh +0 -70
  297. package/templates/.project/scripts/session/create-pr.sh +0 -165
  298. package/templates/.project/scripts/session/end.sh +0 -207
  299. package/templates/.project/scripts/session/start.sh +0 -233
  300. package/templates/.project/scripts/setup/doctor.sh +0 -404
  301. package/templates/.project/scripts/setup/interactive-setup.sh +0 -585
  302. package/templates/.project/scripts/sync/sync-template.sh +0 -328
  303. package/templates/.project/scripts/test/run-all.sh +0 -179
  304. package/templates/.project/scripts/test/run-quick.sh +0 -25
  305. package/templates/Makefile +0 -514
  306. package/templates/config/versions.yaml +0 -57
  307. package/templates/configs/go/.golangci.yml.template +0 -172
  308. package/templates/configs/go/go.mod.template +0 -15
  309. package/templates/configs/java/README.md +0 -6
  310. package/templates/configs/kotlin/README.md +0 -6
  311. package/templates/configs/node/package.json.template +0 -67
  312. package/templates/configs/node/tsconfig.json.template +0 -53
  313. package/templates/configs/python/pyproject.toml.template +0 -92
  314. package/templates/configs/python/pytest.ini.template +0 -64
  315. package/templates/configs/python/ruff.toml.template +0 -79
  316. package/templates/configs/ruby/README.md +0 -6
  317. package/templates/configs/rust/Cargo.toml.template +0 -51
  318. package/templates/configs/shared/.editorconfig +0 -67
  319. package/templates/scripts/validate-templates.sh +0 -449
@@ -1,328 +0,0 @@
1
- #!/bin/bash
2
- # Sync template updates from the upstream template repository
3
- # This allows pulling improvements without recreating the repo
4
-
5
- set -e
6
-
7
- # Source .env if it exists (for TEMPLATE_REPO_URL)
8
- if [ -f ".env" ]; then
9
- set -a
10
- source .env
11
- set +a
12
- fi
13
-
14
- # Colors
15
- CYAN='\033[36m'
16
- GREEN='\033[32m'
17
- RED='\033[31m'
18
- YELLOW='\033[1;33m'
19
- DIM='\033[2m'
20
- BOLD='\033[1m'
21
- RESET='\033[0m'
22
-
23
- # Configuration (after .env is sourced)
24
- TEMPLATE_REMOTE="template-upstream"
25
- TEMPLATE_REPO="${TEMPLATE_REPO_URL:-https://github.com/siddarthc/codespaces-ai-template-v2.git}"
26
- TEMPLATE_BRANCH="${TEMPLATE_BRANCH:-main}"
27
-
28
- # Files/directories to sync from template
29
- SYNC_PATHS=(
30
- ".template/"
31
- "bootstrap.sh"
32
- )
33
-
34
- # Files to preserve (never overwrite)
35
- PRESERVE_FILES=(
36
- ".project.yaml"
37
- ".env"
38
- ".env.local"
39
- ".env.secrets"
40
- )
41
-
42
- usage() {
43
- echo -e "${CYAN}Usage:${RESET} $0 [command]"
44
- echo ""
45
- echo -e "${CYAN}Commands:${RESET}"
46
- echo " check Check for available updates (default)"
47
- echo " preview Show diff of what would change"
48
- echo " apply Apply template updates"
49
- echo " status Show sync status"
50
- echo ""
51
- echo -e "${CYAN}Environment Variables:${RESET}"
52
- echo " TEMPLATE_REPO_URL Override template repository URL"
53
- echo " TEMPLATE_BRANCH Override template branch (default: main)"
54
- }
55
-
56
- # Ensure template remote exists
57
- setup_remote() {
58
- if ! git remote get-url "$TEMPLATE_REMOTE" &>/dev/null; then
59
- echo -e "${CYAN}Adding template remote...${RESET}"
60
- git remote add "$TEMPLATE_REMOTE" "$TEMPLATE_REPO"
61
- else
62
- # Update URL if changed
63
- local current_url
64
- current_url=$(git remote get-url "$TEMPLATE_REMOTE")
65
- if [ "$current_url" != "$TEMPLATE_REPO" ]; then
66
- echo -e "${CYAN}Updating template remote URL...${RESET}"
67
- git remote set-url "$TEMPLATE_REMOTE" "$TEMPLATE_REPO"
68
- fi
69
- fi
70
- }
71
-
72
- # Fetch latest from template
73
- fetch_template() {
74
- echo -e "${CYAN}Fetching latest from template repository...${RESET}"
75
- echo -e "${DIM}URL: $TEMPLATE_REPO${RESET}"
76
-
77
- # Try fetching (use credential helper for private repos)
78
- if ! git fetch "$TEMPLATE_REMOTE" "$TEMPLATE_BRANCH" --quiet 2>/dev/null; then
79
- # Retry without credentials for public repos
80
- if ! GIT_TERMINAL_PROMPT=0 git -c credential.helper= fetch "$TEMPLATE_REMOTE" "$TEMPLATE_BRANCH" --quiet 2>/dev/null; then
81
- echo -e "${RED}Failed to fetch from template repository${RESET}"
82
- echo -e "${DIM}For private repos, use SSH URL in .env:${RESET}"
83
- echo -e "${DIM} TEMPLATE_REPO_URL=git@github.com:user/repo.git${RESET}"
84
- exit 1
85
- fi
86
- fi
87
- }
88
-
89
- # Get current template version (last synced commit)
90
- get_local_version() {
91
- if [ -f ".template-version" ]; then
92
- cat ".template-version"
93
- else
94
- echo "unknown"
95
- fi
96
- }
97
-
98
- # Get latest template version
99
- get_remote_version() {
100
- git rev-parse "$TEMPLATE_REMOTE/$TEMPLATE_BRANCH" 2>/dev/null || echo "unknown"
101
- }
102
-
103
- # Check for updates
104
- check_updates() {
105
- setup_remote
106
- fetch_template
107
-
108
- local local_version
109
- local remote_version
110
- local_version=$(get_local_version)
111
- remote_version=$(get_remote_version)
112
-
113
- echo -e "${CYAN}Template Sync Status${RESET}"
114
- echo "===================="
115
- echo ""
116
- echo -e " ${DIM}Local version:${RESET} ${local_version:0:8}"
117
- echo -e " ${DIM}Remote version:${RESET} ${remote_version:0:8}"
118
- echo ""
119
-
120
- if [ "$local_version" = "$remote_version" ]; then
121
- echo -e "${GREEN}Already up to date${RESET}"
122
- return 0
123
- elif [ "$local_version" = "unknown" ]; then
124
- echo -e "${YELLOW}Template version not tracked yet${RESET}"
125
- echo -e "${DIM}Run 'make sync-template-apply' to sync and start tracking${RESET}"
126
- return 1
127
- else
128
- # Count commits behind
129
- local commits_behind
130
- commits_behind=$(git rev-list --count "$local_version".."$TEMPLATE_REMOTE/$TEMPLATE_BRANCH" 2>/dev/null || echo "?")
131
- echo -e "${YELLOW}$commits_behind commit(s) behind template${RESET}"
132
- echo ""
133
- echo -e "${DIM}Run 'make sync-template-preview' to see changes${RESET}"
134
- echo -e "${DIM}Run 'make sync-template-apply' to apply updates${RESET}"
135
- return 1
136
- fi
137
- }
138
-
139
- # Preview changes
140
- preview_changes() {
141
- setup_remote
142
- fetch_template
143
-
144
- local local_version
145
- local_version=$(get_local_version)
146
-
147
- echo -e "${CYAN}Preview: Template Changes${RESET}"
148
- echo "========================="
149
- echo ""
150
-
151
- if [ "$local_version" = "unknown" ]; then
152
- echo -e "${YELLOW}No baseline version - showing current template state${RESET}"
153
- echo ""
154
- for path in "${SYNC_PATHS[@]}"; do
155
- if git ls-tree -r "$TEMPLATE_REMOTE/$TEMPLATE_BRANCH" --name-only "$path" 2>/dev/null | head -10; then
156
- :
157
- fi
158
- done
159
- return 0
160
- fi
161
-
162
- echo -e "${DIM}Changes from ${local_version:0:8} to $(get_remote_version | head -c 8)${RESET}"
163
- echo ""
164
-
165
- # Show commit log
166
- echo -e "${CYAN}Commits:${RESET}"
167
- git log --oneline "$local_version".."$TEMPLATE_REMOTE/$TEMPLATE_BRANCH" -- "${SYNC_PATHS[@]}" 2>/dev/null | head -20
168
- echo ""
169
-
170
- # Show file changes
171
- echo -e "${CYAN}Changed files:${RESET}"
172
- git diff --stat "$local_version".."$TEMPLATE_REMOTE/$TEMPLATE_BRANCH" -- "${SYNC_PATHS[@]}" 2>/dev/null
173
- echo ""
174
-
175
- # Show detailed diff (truncated)
176
- echo -e "${CYAN}Diff preview (first 100 lines):${RESET}"
177
- git diff "$local_version".."$TEMPLATE_REMOTE/$TEMPLATE_BRANCH" -- "${SYNC_PATHS[@]}" 2>/dev/null | head -100
178
-
179
- local total_lines
180
- total_lines=$(git diff "$local_version".."$TEMPLATE_REMOTE/$TEMPLATE_BRANCH" -- "${SYNC_PATHS[@]}" 2>/dev/null | wc -l)
181
- if [ "$total_lines" -gt 100 ]; then
182
- echo ""
183
- echo -e "${DIM}... ($((total_lines - 100)) more lines)${RESET}"
184
- fi
185
- }
186
-
187
- # Apply updates
188
- apply_updates() {
189
- setup_remote
190
- fetch_template
191
-
192
- local remote_version
193
- remote_version=$(get_remote_version)
194
-
195
- echo -e "${CYAN}Applying Template Updates${RESET}"
196
- echo "========================="
197
- echo ""
198
-
199
- # Check for uncommitted changes
200
- if ! git diff-index --quiet HEAD -- "${SYNC_PATHS[@]}" 2>/dev/null; then
201
- echo -e "${YELLOW}Warning: You have uncommitted changes in template files${RESET}"
202
- echo -e "${DIM}Consider committing or stashing them first${RESET}"
203
- echo ""
204
- read -p "Continue anyway? [y/N]: " -n 1 -r
205
- echo
206
- if [[ ! $REPLY =~ ^[Yy]$ ]]; then
207
- echo -e "${RED}Aborted${RESET}"
208
- exit 1
209
- fi
210
- fi
211
-
212
- # Backup preserved files
213
- echo -e "${CYAN}Backing up preserved files...${RESET}"
214
- local backup_dir=".template-sync-backup"
215
- rm -rf "$backup_dir"
216
- mkdir -p "$backup_dir"
217
-
218
- for file in "${PRESERVE_FILES[@]}"; do
219
- if [ -f "$file" ]; then
220
- cp "$file" "$backup_dir/"
221
- echo -e " ${DIM}Backed up: $file${RESET}"
222
- fi
223
- done
224
-
225
- # Checkout template files
226
- echo ""
227
- echo -e "${CYAN}Updating template files...${RESET}"
228
- for path in "${SYNC_PATHS[@]}"; do
229
- if git ls-tree -r "$TEMPLATE_REMOTE/$TEMPLATE_BRANCH" --name-only "$path" &>/dev/null; then
230
- echo -e " ${DIM}Syncing: $path${RESET}"
231
- git checkout "$TEMPLATE_REMOTE/$TEMPLATE_BRANCH" -- "$path" 2>/dev/null || true
232
- fi
233
- done
234
-
235
- # Restore preserved files
236
- echo ""
237
- echo -e "${CYAN}Restoring preserved files...${RESET}"
238
- for file in "${PRESERVE_FILES[@]}"; do
239
- if [ -f "$backup_dir/$(basename "$file")" ]; then
240
- cp "$backup_dir/$(basename "$file")" "$file"
241
- echo -e " ${DIM}Restored: $file${RESET}"
242
- fi
243
- done
244
-
245
- # Clean up backup
246
- rm -rf "$backup_dir"
247
-
248
- # Update version file
249
- echo "$remote_version" > ".template-version"
250
- echo ""
251
- echo -e "${GREEN}Template updated to ${remote_version:0:8}${RESET}"
252
- echo ""
253
-
254
- # Show what changed
255
- echo -e "${CYAN}Changes applied:${RESET}"
256
- git status --short "${SYNC_PATHS[@]}" .template-version 2>/dev/null
257
- echo ""
258
-
259
- echo -e "${DIM}Review changes with: git diff${RESET}"
260
- echo -e "${DIM}Commit with: git add -A && git commit -m 'chore: sync template updates'${RESET}"
261
- }
262
-
263
- # Show status
264
- show_status() {
265
- echo -e "${CYAN}Template Sync Configuration${RESET}"
266
- echo "============================"
267
- echo ""
268
- echo -e " ${DIM}Remote name:${RESET} $TEMPLATE_REMOTE"
269
- echo -e " ${DIM}Repository:${RESET} $TEMPLATE_REPO"
270
- echo -e " ${DIM}Branch:${RESET} $TEMPLATE_BRANCH"
271
- echo ""
272
-
273
- if git remote get-url "$TEMPLATE_REMOTE" &>/dev/null; then
274
- echo -e " ${GREEN}Remote configured${RESET}"
275
- else
276
- echo -e " ${YELLOW}Remote not configured${RESET}"
277
- fi
278
-
279
- echo ""
280
- echo -e "${CYAN}Sync Paths:${RESET}"
281
- for path in "${SYNC_PATHS[@]}"; do
282
- echo -e " - $path"
283
- done
284
-
285
- echo ""
286
- echo -e "${CYAN}Preserved Files:${RESET}"
287
- for file in "${PRESERVE_FILES[@]}"; do
288
- if [ -f "$file" ]; then
289
- echo -e " - $file ${GREEN}(exists)${RESET}"
290
- else
291
- echo -e " - $file ${DIM}(not found)${RESET}"
292
- fi
293
- done
294
-
295
- echo ""
296
- local_version=$(get_local_version)
297
- echo -e "${CYAN}Version Tracking:${RESET}"
298
- if [ "$local_version" = "unknown" ]; then
299
- echo -e " ${YELLOW}Not tracking template version${RESET}"
300
- echo -e " ${DIM}Run sync-template-apply to start tracking${RESET}"
301
- else
302
- echo -e " ${DIM}Last synced:${RESET} ${local_version:0:8}"
303
- fi
304
- }
305
-
306
- # Main
307
- case "${1:-check}" in
308
- check)
309
- check_updates
310
- ;;
311
- preview)
312
- preview_changes
313
- ;;
314
- apply)
315
- apply_updates
316
- ;;
317
- status)
318
- show_status
319
- ;;
320
- -h|--help|help)
321
- usage
322
- ;;
323
- *)
324
- echo -e "${RED}Unknown command: $1${RESET}"
325
- usage
326
- exit 1
327
- ;;
328
- esac
@@ -1,179 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- # Colors
5
- CYAN='\033[36m'
6
- GREEN='\033[32m'
7
- RED='\033[31m'
8
- YELLOW='\033[1;33m'
9
- DIM='\033[2m'
10
- RESET='\033[0m'
11
-
12
- # Helper to read config from .project.yaml
13
- read_config() {
14
- local path="$1"
15
- local default="$2"
16
- if [ -f ".project.yaml" ] && command -v python3 &> /dev/null; then
17
- python3 -c "
18
- import yaml
19
- try:
20
- with open('.project.yaml') as f:
21
- c = yaml.safe_load(f)
22
- keys = '$path'.split('.')
23
- val = c
24
- for k in keys:
25
- val = val.get(k, {}) if isinstance(val, dict) else {}
26
- print(val if val and val != {} else '$default')
27
- except:
28
- print('$default')
29
- " 2>/dev/null || echo "$default"
30
- else
31
- echo "$default"
32
- fi
33
- }
34
-
35
- # Create tmp directory for reports
36
- mkdir -p tmp/reports
37
-
38
- REPORT_FILE="tmp/reports/test-report.md"
39
- TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
40
- FAILED=0
41
-
42
- # Start report
43
- cat > "$REPORT_FILE" << EOF
44
- # Test Report
45
-
46
- **Generated:** $TIMESTAMP
47
-
48
- ---
49
-
50
- EOF
51
-
52
- echo -e "${CYAN}Running all tests...${RESET}"
53
-
54
- # Test Go packages
55
- echo "## Go Tests" >> "$REPORT_FILE"
56
- if find . -name "go.mod" -type f -not -path "./v0/*" -not -path "./.template/*" | grep -q .; then
57
- echo -e "${CYAN}Testing Go packages...${RESET}"
58
- if go test ./... -v 2>&1 | tee /tmp/go-test.log; then
59
- echo "✅ **PASSED**" >> "$REPORT_FILE"
60
- echo -e "${GREEN}✓${RESET} Go tests passed"
61
- else
62
- echo "❌ **FAILED**" >> "$REPORT_FILE"
63
- echo -e "${RED}✗${RESET} Go tests failed"
64
- FAILED=1
65
- fi
66
- else
67
- echo "_No Go packages found_" >> "$REPORT_FILE"
68
- fi
69
- echo "" >> "$REPORT_FILE"
70
-
71
- # Test Python packages
72
- echo "## Python Tests" >> "$REPORT_FILE"
73
- PYTHON_TESTED=false
74
-
75
- # Check for pytest
76
- if command -v pytest &> /dev/null; then
77
- # Test root pyproject.toml
78
- if [ -f "pyproject.toml" ]; then
79
- PYTHON_TESTED=true
80
- echo -e "${CYAN}Testing Python packages...${RESET}"
81
- if pytest -v --tb=short 2>&1 | tee /tmp/python-test.log; then
82
- echo "✅ **PASSED**" >> "$REPORT_FILE"
83
- echo -e "${GREEN}✓${RESET} Python tests passed"
84
- else
85
- echo "❌ **FAILED**" >> "$REPORT_FILE"
86
- echo -e "${RED}✗${RESET} Python tests failed"
87
- FAILED=1
88
- fi
89
- fi
90
-
91
- # Test service-specific packages
92
- for dir in $(find pkg/python services/python -name "pyproject.toml" 2>/dev/null | xargs -r dirname | sort -u); do
93
- if [ -d "$dir" ]; then
94
- PYTHON_TESTED=true
95
- echo "### $(basename $dir)" >> "$REPORT_FILE"
96
- if (cd "$dir" && pytest -v --tb=short 2>&1); then
97
- echo "✅ Passed" >> "$REPORT_FILE"
98
- else
99
- echo "❌ Failed" >> "$REPORT_FILE"
100
- FAILED=1
101
- fi
102
- fi
103
- done
104
- fi
105
-
106
- if [ "$PYTHON_TESTED" = false ]; then
107
- echo "_No Python test packages found_" >> "$REPORT_FILE"
108
- fi
109
- echo "" >> "$REPORT_FILE"
110
-
111
- # Test Next.js frontend
112
- echo "## Next.js Tests" >> "$REPORT_FILE"
113
- if [ -d "frontend" ] && [ -f "frontend/package.json" ]; then
114
- # Check if test script exists in package.json
115
- if grep -q '"test"' frontend/package.json 2>/dev/null; then
116
- echo -e "${CYAN}Testing Next.js frontend...${RESET}"
117
-
118
- # Get coverage threshold from config
119
- NEXTJS_THRESHOLD=$(read_config "nextjs.coverage_threshold" "")
120
- if [ -z "$NEXTJS_THRESHOLD" ]; then
121
- NEXTJS_THRESHOLD=$(read_config "quality.coverage_threshold" "80")
122
- fi
123
-
124
- # Run tests with coverage
125
- echo "### Test Results" >> "$REPORT_FILE"
126
- if (cd frontend && npm test -- --coverage --passWithNoTests 2>&1) | tee /tmp/nextjs-test.log; then
127
- echo "✅ **PASSED**" >> "$REPORT_FILE"
128
- echo -e "${GREEN}✓${RESET} Next.js tests passed"
129
-
130
- # Check coverage if coverage report exists
131
- if [ -f "frontend/coverage/coverage-summary.json" ]; then
132
- echo "" >> "$REPORT_FILE"
133
- echo "### Coverage" >> "$REPORT_FILE"
134
- COVERAGE=$(python3 -c "
135
- import json
136
- with open('frontend/coverage/coverage-summary.json') as f:
137
- data = json.load(f)
138
- total = data.get('total', {})
139
- lines = total.get('lines', {}).get('pct', 0)
140
- print(f'{lines:.1f}')
141
- " 2>/dev/null || echo "0")
142
- echo "- Lines: ${COVERAGE}% (threshold: ${NEXTJS_THRESHOLD}%)" >> "$REPORT_FILE"
143
- echo -e "${CYAN} Coverage: ${COVERAGE}% (threshold: ${NEXTJS_THRESHOLD}%)${RESET}"
144
-
145
- # Check if below threshold
146
- if command -v bc &> /dev/null; then
147
- if (( $(echo "$COVERAGE < $NEXTJS_THRESHOLD" | bc -l) )); then
148
- echo "⚠️ **Below threshold**" >> "$REPORT_FILE"
149
- echo -e "${YELLOW}!${RESET} Coverage below threshold"
150
- fi
151
- fi
152
- fi
153
- else
154
- echo "❌ **FAILED**" >> "$REPORT_FILE"
155
- echo -e "${RED}✗${RESET} Next.js tests failed"
156
- FAILED=1
157
- fi
158
- else
159
- echo "_No test script in frontend/package.json_" >> "$REPORT_FILE"
160
- echo -e "${DIM}○ No test script found in frontend/package.json${RESET}"
161
- fi
162
- else
163
- echo "_No frontend/ directory found_" >> "$REPORT_FILE"
164
- fi
165
- echo "" >> "$REPORT_FILE"
166
-
167
- # Summary
168
- echo "---" >> "$REPORT_FILE"
169
- if [ $FAILED -eq 0 ]; then
170
- echo "## ✅ Result: PASSED" >> "$REPORT_FILE"
171
- echo -e "${GREEN}✅ All tests passed${RESET}"
172
- else
173
- echo "## ❌ Result: FAILED" >> "$REPORT_FILE"
174
- echo -e "${RED}❌ Tests failed${RESET}"
175
- fi
176
-
177
- echo -e "${CYAN}📊 Report: $REPORT_FILE${RESET}"
178
-
179
- exit $FAILED
@@ -1,25 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Colors
4
- CYAN='\033[36m'
5
- GREEN='\033[32m'
6
- RESET='\033[0m'
7
-
8
- echo -e "${CYAN}⚡ Running Quick Tests (Unit Only)${RESET}"
9
- echo "===================================="
10
- echo ""
11
-
12
- # Run Go unit tests
13
- if find . -name "go.mod" -type f -not -path "./v0/*" | grep -q .; then
14
- echo -e "${CYAN}Go tests...${RESET}"
15
- go test ./... -short 2>&1 | grep -E "PASS|FAIL|ok|coverage" || true
16
- fi
17
-
18
- # Run Python unit tests
19
- if command -v pytest &> /dev/null && [ -f "pyproject.toml" ]; then
20
- echo -e "${CYAN}Python tests...${RESET}"
21
- pytest -q --tb=no 2>&1 | grep -E "passed|failed|PASSED|FAILED" || true
22
- fi
23
-
24
- echo ""
25
- echo -e "${GREEN}✅ Quick tests complete!${RESET}"