@monster-orange/den 0.0.0 → 0.1.0
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.
- package/CHANGELOG.md +67 -0
- package/LICENSE +21 -0
- package/README.md +165 -1
- package/bin/den +61 -0
- package/docs/distributions.md +256 -0
- package/make/demo.mk +82 -0
- package/make/den.mk +80 -0
- package/make/journeys.mk +57 -0
- package/make/local_dev.mk +154 -0
- package/make/security.mk +59 -0
- package/make/test.mk +405 -0
- package/package.json +99 -4
- package/scripts/auth-configure.ts +415 -0
- package/scripts/heal-config.ts +92 -0
- package/scripts/jsonl-playwright-reporter.js +70 -0
- package/scripts/manifest-read.cjs +91 -0
- package/scripts/setup-1password.ts +570 -0
- package/scripts/setup-secrets.ts +149 -0
- package/scripts/view-results.js +156 -0
- package/service/install.sh +112 -0
- package/src/pillars/api/fixtures/index.ts +128 -0
- package/src/pillars/api/fixtures/openapi-validator.ts +111 -0
- package/src/pillars/api/global-setup.ts +103 -0
- package/src/pillars/api/playwright.config.ts +105 -0
- package/src/pillars/api/schemas/example-api.json +110 -0
- package/src/pillars/api/tests/health/health.spec.ts +19 -0
- package/src/pillars/api/tests/health/manifest.yml +6 -0
- package/src/pillars/browser/fixtures/index.ts +232 -0
- package/src/pillars/browser/fixtures/package.json +10 -0
- package/src/pillars/browser/global-setup.ts +140 -0
- package/src/pillars/browser/global-teardown.ts +48 -0
- package/src/pillars/browser/playwright.config.ts +212 -0
- package/src/pillars/browser/setup.ts +219 -0
- package/src/pillars/journeys/app-config.ts +237 -0
- package/src/pillars/journeys/discover.ts +160 -0
- package/src/pillars/journeys/hooks/deny-shell.cjs +44 -0
- package/src/pillars/journeys/observability/events.ts +288 -0
- package/src/pillars/journeys/observability/sdk-mapper.ts +306 -0
- package/src/pillars/journeys/report/friction.ts +304 -0
- package/src/pillars/journeys/report/junit.ts +105 -0
- package/src/pillars/journeys/report/render.ts +273 -0
- package/src/pillars/journeys/report/results.ts +323 -0
- package/src/pillars/journeys/run.ts +673 -0
- package/src/pillars/journeys/runner.ts +1025 -0
- package/src/pillars/journeys/sandbox.ts +406 -0
- package/src/pillars/journeys/spec/loader.ts +152 -0
- package/src/pillars/journeys/spec/schema.ts +208 -0
- package/src/pillars/journeys/teardown.ts +98 -0
- package/src/pillars/journeys/tools/browser-session.ts +219 -0
- package/src/pillars/journeys/tools/browser-tool.ts +914 -0
- package/src/pillars/journeys/tools/http-tool.ts +564 -0
- package/src/pillars/journeys/tools/ledger.ts +278 -0
- package/src/pillars/journeys/tools/snapshot-store.ts +117 -0
- package/src/pillars/journeys/verify/assertions.ts +502 -0
- package/src/pillars/journeys/verify/verdict.ts +71 -0
- package/src/pillars/perf/build-report.ts +36 -0
- package/src/pillars/perf/k6.config.js +112 -0
- package/src/pillars/perf/run.ts +345 -0
- package/src/pillars/perf/scenarios/load-profile.js +97 -0
- package/src/pillars/perf/staging.ts +73 -0
- package/src/pillars/security/discover.ts +108 -0
- package/src/pillars/security/findings.ts +151 -0
- package/src/pillars/security/plan.ts +355 -0
- package/src/pillars/security/run.ts +729 -0
- package/src/pillars/smoke/admin-probe.ts +68 -0
- package/src/pillars/smoke/base-url.ts +56 -0
- package/src/pillars/smoke/cleanup.ts +8 -0
- package/src/pillars/smoke/discover.ts +237 -0
- package/src/pillars/smoke/ensure-smoke-teardown.ts +40 -0
- package/src/pillars/smoke/fixture-manager.ts +217 -0
- package/src/pillars/smoke/fixtures.ts +468 -0
- package/src/pillars/smoke/global-setup-all.ts +262 -0
- package/src/pillars/smoke/global-setup-global.ts +262 -0
- package/src/pillars/smoke/global-setup.ts +273 -0
- package/src/pillars/smoke/global-teardown-all.ts +8 -0
- package/src/pillars/smoke/global-teardown-global.ts +8 -0
- package/src/pillars/smoke/global-teardown.ts +139 -0
- package/src/pillars/smoke/playwright-all.config.ts +147 -0
- package/src/pillars/smoke/playwright-global.config.ts +141 -0
- package/src/pillars/smoke/playwright.config.ts +162 -0
- package/src/pillars/smoke/setup-env.ts +132 -0
- package/src/pillars/smoke/setup-global.ts +126 -0
- package/src/pillars/smoke/setup.ts +115 -0
- package/src/pillars/smoke/smoke-repo.ts +16 -0
- package/src/pillars/smoke/staging.ts +49 -0
- package/src/pillars/suites/run.ts +147 -0
- package/src/scripts/configure-aws-profiles.ts +114 -0
- package/src/scripts/register-repos.ts +307 -0
- package/src/scripts/setup-default-workspace.ts +203 -0
- package/src/shared/applications.ts +138 -0
- package/src/shared/auth/api-token.ts +416 -0
- package/src/shared/auth/auth0-helper.ts +284 -0
- package/src/shared/auth/headless-login.ts +265 -0
- package/src/shared/auth/jwt-helper.ts +186 -0
- package/src/shared/auth/sudo-vault.ts +69 -0
- package/src/shared/auth/test-accounts.ts +98 -0
- package/src/shared/auth/token-injection.ts +184 -0
- package/src/shared/auth/token-providers/auth0.ts +80 -0
- package/src/shared/auth/token-providers/index.ts +182 -0
- package/src/shared/auth/token-refresh.ts +273 -0
- package/src/shared/banner.ts +15 -0
- package/src/shared/brand.ts +79 -0
- package/src/shared/cli-tabs.ts +131 -0
- package/src/shared/constants.ts +128 -0
- package/src/shared/den-config.ts +566 -0
- package/src/shared/dev-metrics/emit.ts +354 -0
- package/src/shared/edge/config.ts +229 -0
- package/src/shared/edge/render.ts +221 -0
- package/src/shared/edge/runtime.ts +268 -0
- package/src/shared/edge/types.ts +62 -0
- package/src/shared/engine.ts +67 -0
- package/src/shared/environment/aws-profiles.ts +49 -0
- package/src/shared/environment/env-selector.ts +161 -0
- package/src/shared/environment/playwright-env.ts +82 -0
- package/src/shared/environment-manager/catalog.ts +77 -0
- package/src/shared/environment-manager/clone-guard.ts +163 -0
- package/src/shared/environment-manager/dag.ts +286 -0
- package/src/shared/environment-manager/default-workspace.ts +182 -0
- package/src/shared/environment-manager/derivation/alias.ts +90 -0
- package/src/shared/environment-manager/derivation/cache.ts +97 -0
- package/src/shared/environment-manager/derivation/derive-graph.ts +421 -0
- package/src/shared/environment-manager/derivation/derived-up.ts +354 -0
- package/src/shared/environment-manager/derivation/load-alias.ts +11 -0
- package/src/shared/environment-manager/derivation/rules-compose.ts +42 -0
- package/src/shared/environment-manager/derivation/rules-events.ts +50 -0
- package/src/shared/environment-manager/derivation/rules-http.ts +247 -0
- package/src/shared/environment-manager/derivation/rules-infra.ts +64 -0
- package/src/shared/environment-manager/derivation/rules-readiness.ts +96 -0
- package/src/shared/environment-manager/derivation/scan.ts +160 -0
- package/src/shared/environment-manager/derivation/text.ts +40 -0
- package/src/shared/environment-manager/derivation/types.ts +69 -0
- package/src/shared/environment-manager/health.ts +589 -0
- package/src/shared/environment-manager/index.ts +6 -0
- package/src/shared/environment-manager/load-applications.ts +78 -0
- package/src/shared/environment-manager/log-tail.ts +212 -0
- package/src/shared/environment-manager/make-targets.ts +78 -0
- package/src/shared/environment-manager/opctl.ts +334 -0
- package/src/shared/environment-manager/readiness.ts +93 -0
- package/src/shared/environment-manager/register-local.ts +72 -0
- package/src/shared/environment-manager/secrets-check.ts +260 -0
- package/src/shared/environment-manager/service-env.ts +110 -0
- package/src/shared/environment-manager/service-runner.ts +1588 -0
- package/src/shared/environment-manager/up-plan.ts +302 -0
- package/src/shared/environment-manager/workspace-manager.ts +905 -0
- package/src/shared/environment-manager/workspaces.ts +860 -0
- package/src/shared/manifest/deps.ts +27 -0
- package/src/shared/manifest/migrate-manifest.ts +101 -0
- package/src/shared/manifest/read-manifest.ts +160 -0
- package/src/shared/manifest/schema.ts +299 -0
- package/src/shared/manifest/service-links.ts +93 -0
- package/src/shared/manifest/validate-manifest.ts +140 -0
- package/src/shared/manifest/workspace-manifests.ts +92 -0
- package/src/shared/open-url.ts +122 -0
- package/src/shared/org.ts +44 -0
- package/src/shared/paths.ts +178 -0
- package/src/shared/perf/optional-fields.ts +105 -0
- package/src/shared/perf/report-normalizer.ts +404 -0
- package/src/shared/perf/report-paths.ts +19 -0
- package/src/shared/perf/report-store.ts +110 -0
- package/src/shared/perf/report-types.ts +70 -0
- package/src/shared/perf/test-paths.ts +25 -0
- package/src/shared/process/log-rotation.ts +147 -0
- package/src/shared/process/spawn-streaming.ts +229 -0
- package/src/shared/product.ts +92 -0
- package/src/shared/profile.ts +141 -0
- package/src/shared/repo-kind.ts +32 -0
- package/src/shared/reporting/jsonl-reporter.ts +131 -0
- package/src/shared/reporting/slack-reporter.ts +340 -0
- package/src/shared/results/result-reader.ts +266 -0
- package/src/shared/results/result-writer.ts +168 -0
- package/src/shared/secrets/doppler.ts +126 -0
- package/src/shared/secrets/env.ts +48 -0
- package/src/shared/secrets/index.ts +197 -0
- package/src/shared/secrets/keys.ts +33 -0
- package/src/shared/secrets/onepassword.ts +75 -0
- package/src/shared/secrets/types.ts +52 -0
- package/src/shared/service-url.ts +119 -0
- package/src/shared/smoke/branch-resolver.ts +141 -0
- package/src/shared/smoke/git-remote.ts +70 -0
- package/src/shared/smoke/repo-cloner.ts +151 -0
- package/src/shared/stacks/config.ts +137 -0
- package/src/shared/stacks/manifest-commands.ts +88 -0
- package/src/shared/stacks/render.ts +253 -0
- package/src/shared/stacks/runtime.ts +334 -0
- package/src/shared/stacks/types.ts +53 -0
- package/src/shared/terminal/tabs.ts +212 -0
- package/src/shared/test-discovery/module-scanner.ts +569 -0
- package/src/shared/types/index.ts +678 -0
- package/src/shared/ui-marker.ts +19 -0
- package/src/ui/cli/applications-command.ts +116 -0
- package/src/ui/cli/config-command.ts +68 -0
- package/src/ui/cli/create-main.ts +9 -0
- package/src/ui/cli/create.ts +360 -0
- package/src/ui/cli/edge-command.ts +91 -0
- package/src/ui/cli/flag-parser.ts +246 -0
- package/src/ui/cli/graph-command.ts +524 -0
- package/src/ui/cli/health-display.ts +63 -0
- package/src/ui/cli/index.ts +3656 -0
- package/src/ui/cli/init.ts +855 -0
- package/src/ui/cli/invocation-target.ts +175 -0
- package/src/ui/cli/logs-command.ts +104 -0
- package/src/ui/cli/module-selection.ts +31 -0
- package/src/ui/cli/prompts.ts +767 -0
- package/src/ui/cli/results-viewer.ts +436 -0
- package/src/ui/cli/secrets-preflight.ts +91 -0
- package/src/ui/cli/stack-command.ts +144 -0
- package/src/ui/cli/stalled-setup-recovery.ts +129 -0
- package/src/ui/cli/test-runner.ts +1312 -0
- package/src/ui/cli/web-command.ts +1073 -0
- package/src/ui/server/changelog-parser.ts +94 -0
- package/src/ui/server/daemon-reaper.ts +129 -0
- package/src/ui/server/editor-manager.ts +301 -0
- package/src/ui/server/github-service.ts +223 -0
- package/src/ui/server/http-helpers.ts +98 -0
- package/src/ui/server/index.ts +3236 -0
- package/src/ui/server/log-history.ts +452 -0
- package/src/ui/server/perf-report.ts +42 -0
- package/src/ui/server/public/environments.html +494 -0
- package/src/ui/server/public/favicon.ico +0 -0
- package/src/ui/server/public/header.js +1371 -0
- package/src/ui/server/public/index.html +2595 -0
- package/src/ui/server/public/local-dev.html +7405 -0
- package/src/ui/server/public/logs.html +1489 -0
- package/src/ui/server/public/perf-report.js +359 -0
- package/src/ui/server/public/release.html +2111 -0
- package/src/ui/server/public/services.html +1098 -0
- package/src/ui/server/public/workspace-picker.js +69 -0
- package/src/ui/server/release-deploy-session.ts +246 -0
- package/src/ui/server/release-service.ts +1125 -0
- package/src/ui/server/sudo-store.ts +111 -0
- package/src/ui/server/workspace-routes.ts +2154 -0
package/make/den.mk
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# make/den.mk — Den's make targets, for any distribution.
|
|
2
|
+
#
|
|
3
|
+
# A distribution's Makefile includes it from the installed package:
|
|
4
|
+
#
|
|
5
|
+
# include node_modules/@monster-orange/den/make/den.mk
|
|
6
|
+
#
|
|
7
|
+
# Den's own Makefile includes it too (include make/den.mk). Recipes run from
|
|
8
|
+
# the distribution root (the directory make runs in: config/, manifests/,
|
|
9
|
+
# reports/ and results/ live there) and reach Den's own files through
|
|
10
|
+
# $(DEN_ENGINE). In Den's checkout the two are the same directory.
|
|
11
|
+
|
|
12
|
+
# Prefix of the service and setup targets (`make <prefix>-up`, -status, …):
|
|
13
|
+
# the distribution's own name. Set it before the include; Den's own is "den".
|
|
14
|
+
DEN_TARGET_PREFIX ?= den
|
|
15
|
+
|
|
16
|
+
# Den's package root: the directory above this file.
|
|
17
|
+
DEN_ENGINE ?= $(patsubst %/,%,$(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..))
|
|
18
|
+
|
|
19
|
+
# The distribution root, and the engine, for every Den process a recipe runs.
|
|
20
|
+
DEN_ROOT ?= $(CURDIR)
|
|
21
|
+
export DEN_ROOT
|
|
22
|
+
DEN_ENGINE_ROOT := $(DEN_ENGINE)
|
|
23
|
+
export DEN_ENGINE_ROOT
|
|
24
|
+
|
|
25
|
+
# Binaries from Den's dependencies: Den's own node_modules (a checkout) or
|
|
26
|
+
# the distribution's, where npm hoists them.
|
|
27
|
+
den_bin = $(firstword $(wildcard $(DEN_ENGINE)/node_modules/.bin/$(1) $(CURDIR)/node_modules/.bin/$(1)) $(1))
|
|
28
|
+
DEN_TSX ?= $(call den_bin,tsx)
|
|
29
|
+
DEN_PLAYWRIGHT ?= $(call den_bin,playwright)
|
|
30
|
+
# The CLI (as `den`, or the distribution's own name via its den.yml).
|
|
31
|
+
DEN_BIN ?= $(DEN_ENGINE)/bin/den
|
|
32
|
+
DEN_CLI_TS ?= $(DEN_TSX) $(DEN_ENGINE)/src/ui/cli/index.ts
|
|
33
|
+
|
|
34
|
+
# ── Globals ───────────────────────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
# Environment selection — defaults to local.
|
|
37
|
+
# Usage: make test-syn-all env=staging
|
|
38
|
+
env ?= local
|
|
39
|
+
export E2E_ENVIRONMENT=$(env)
|
|
40
|
+
OPEN_REPORT ?= 0
|
|
41
|
+
|
|
42
|
+
# Secrets backend is a strategy chosen in the org config (secrets.provider:
|
|
43
|
+
# doppler | 1password | env). Override per shell:
|
|
44
|
+
# DEN_SECRETS_PROVIDER=env make up
|
|
45
|
+
# OP_ACCOUNT is only consulted when the 1password strategy is selected.
|
|
46
|
+
OP_ACCOUNT ?= example.1password.com
|
|
47
|
+
export OP_ACCOUNT
|
|
48
|
+
|
|
49
|
+
# Repo for the smoke and browser pillars — no default: make test-smk-all repo=<repo>
|
|
50
|
+
repo ?=
|
|
51
|
+
|
|
52
|
+
# ── Fragments ─────────────────────────────────────────────────────────────────
|
|
53
|
+
include $(DEN_ENGINE)/make/test.mk
|
|
54
|
+
include $(DEN_ENGINE)/make/local_dev.mk
|
|
55
|
+
include $(DEN_ENGINE)/make/journeys.mk
|
|
56
|
+
include $(DEN_ENGINE)/make/security.mk
|
|
57
|
+
include $(DEN_ENGINE)/make/demo.mk
|
|
58
|
+
|
|
59
|
+
# ── Help ──────────────────────────────────────────────────────────────────────
|
|
60
|
+
# A distribution gets `make help` from here; Den's own Makefile has a longer
|
|
61
|
+
# one and sets DEN_OWN_HELP before including this file.
|
|
62
|
+
.PHONY: $(DEN_TARGET_PREFIX)-help
|
|
63
|
+
$(DEN_TARGET_PREFIX)-help:
|
|
64
|
+
@printf '\nDen targets (run from this directory)\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n'
|
|
65
|
+
@printf ' make test interactive test runner\n'
|
|
66
|
+
@printf ' make web the web UI\n'
|
|
67
|
+
@printf ' make $(DEN_TARGET_PREFIX)-up / down start / stop services\n'
|
|
68
|
+
@printf ' make $(DEN_TARGET_PREFIX)-status service status\n'
|
|
69
|
+
@printf ' make test-syn-all repo=R browser tests\n'
|
|
70
|
+
@printf ' make test-int-all API tests\n'
|
|
71
|
+
@printf ' make test-smk-all repo=R smoke tests\n'
|
|
72
|
+
@printf ' make test-perf module=M performance tests\n'
|
|
73
|
+
@printf ' make test-jrn-all journeys\n'
|
|
74
|
+
@printf ' make test-sec-all security scans\n\n'
|
|
75
|
+
|
|
76
|
+
ifndef DEN_OWN_HELP
|
|
77
|
+
.PHONY: help
|
|
78
|
+
help: $(DEN_TARGET_PREFIX)-help
|
|
79
|
+
.DEFAULT_GOAL := help
|
|
80
|
+
endif
|
package/make/journeys.mk
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# make/journeys.mk — Agent-driven E2E journeys (journeys pillar)
|
|
2
|
+
#
|
|
3
|
+
# Journey specs live in registered service repos (e.g. shop-web) and are
|
|
4
|
+
# discovered through their .den.yml `journeys:` block; the runner drives
|
|
5
|
+
# a sandboxed @cursor/sdk agent per journey. See src/pillars/journeys/.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# make test-jrn-all env=<env> All journeys allowing <env>
|
|
9
|
+
# make test-jrn-<name> env=<env> Single journey by spec name
|
|
10
|
+
# make test-jrn-<name> env=<env> repo=<repo> Disambiguate a spec name
|
|
11
|
+
# duplicated across repos
|
|
12
|
+
# (passes --journey=<repo>/<name>)
|
|
13
|
+
#
|
|
14
|
+
# The root Makefile declares a global `repo` for the smoke pillar.
|
|
15
|
+
# Journeys deliberately ignore that inherited default — only a `repo=` stated
|
|
16
|
+
# on the command line ($(origin repo) == "command line") qualifies the spec
|
|
17
|
+
# name; otherwise the bare name is resolved across all registered repos.
|
|
18
|
+
#
|
|
19
|
+
# EXPLICIT-ENV GUARD: the root Makefile sets `env ?= local`, which would
|
|
20
|
+
# silently point journeys at local. Journeys are agent-driven runs with
|
|
21
|
+
# real side effects, so the env MUST be stated on the command line —
|
|
22
|
+
# $(origin env) is "command line" only then; "file" (the ?= default) and
|
|
23
|
+
# "environment" (an inherited shell var) are both rejected.
|
|
24
|
+
#
|
|
25
|
+
# MODEL: each journey spec may declare its own default (`model:` field);
|
|
26
|
+
# the JOURNEYS_MODEL env var, when set, overrides every spec (operator
|
|
27
|
+
# control, e.g. CI cost pinning). A journey with neither is refused by the
|
|
28
|
+
# runner — no default model is ever invented. CURSOR_API_KEY needs no
|
|
29
|
+
# export — the runner falls back to a 1Password `op read` when unset.
|
|
30
|
+
|
|
31
|
+
.PHONY: test-jrn-all .journeys-check-env
|
|
32
|
+
|
|
33
|
+
.journeys-check-env:
|
|
34
|
+
ifeq ($(origin env),command line)
|
|
35
|
+
@true
|
|
36
|
+
else
|
|
37
|
+
@echo "❌ Journeys require an explicit env=<name> on the command line."
|
|
38
|
+
@echo " The Makefile default (env ?= local) is deliberately rejected for"
|
|
39
|
+
@echo " agent-driven runs. Usage: make test-jrn-all env=local"
|
|
40
|
+
@exit 1
|
|
41
|
+
endif
|
|
42
|
+
|
|
43
|
+
# All journeys whose environments allowlist includes $(env)
|
|
44
|
+
test-jrn-all: .journeys-check-env .check-auth
|
|
45
|
+
@echo "🧭 Running ALL journeys..."
|
|
46
|
+
@echo "🌍 Environment: $(env)"
|
|
47
|
+
@echo ""
|
|
48
|
+
@$(DEN_TSX) $(DEN_ENGINE)/src/pillars/journeys/run.ts --env=$(env)
|
|
49
|
+
|
|
50
|
+
# make test-jrn-<journey-name> env=<env>
|
|
51
|
+
test-jrn-%: .journeys-check-env .check-auth
|
|
52
|
+
@JOURNEY_NAME=$(subst test-jrn-,,$@); \
|
|
53
|
+
$(if $(filter command line,$(origin repo)),JOURNEY_NAME="$(repo)/$$JOURNEY_NAME";) \
|
|
54
|
+
echo "🧭 Running journey $$JOURNEY_NAME..."; \
|
|
55
|
+
echo "🌍 Environment: $(env)"; \
|
|
56
|
+
echo ""; \
|
|
57
|
+
$(DEN_TSX) $(DEN_ENGINE)/src/pillars/journeys/run.ts --env=$(env) --journey=$$JOURNEY_NAME
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# make/local_dev.mk — Local Dev environment manager
|
|
2
|
+
#
|
|
3
|
+
# Manages the Local Dev experience: service clones, workspaces, web UI,
|
|
4
|
+
# secrets setup, repo registration, auth configuration, and AWS profiles.
|
|
5
|
+
|
|
6
|
+
.PHONY: down $(DEN_TARGET_PREFIX)-up $(DEN_TARGET_PREFIX)-down $(DEN_TARGET_PREFIX)-restart $(DEN_TARGET_PREFIX)-status $(DEN_TARGET_PREFIX)-services \
|
|
7
|
+
$(DEN_TARGET_PREFIX)-graph $(DEN_TARGET_PREFIX)-logs \
|
|
8
|
+
$(DEN_TARGET_PREFIX)-register $(DEN_TARGET_PREFIX)-setup $(DEN_TARGET_PREFIX)-sync $(DEN_TARGET_PREFIX)-workspace \
|
|
9
|
+
$(DEN_TARGET_PREFIX)-init $(DEN_TARGET_PREFIX)-validate $(DEN_TARGET_PREFIX)-local-dev $(DEN_TARGET_PREFIX)-setup-secrets $(DEN_TARGET_PREFIX)-setup-1password \
|
|
10
|
+
register-repos aws-configure auth-configure \
|
|
11
|
+
web dev-dns
|
|
12
|
+
|
|
13
|
+
# ── Service management ────────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
# Start always_on services in the active workspace.
|
|
16
|
+
# Usage: make $(DEN_TARGET_PREFIX)-up OR make $(DEN_TARGET_PREFIX)-up args="shop/api tasks-runner"
|
|
17
|
+
$(DEN_TARGET_PREFIX)-up:
|
|
18
|
+
@if ! $(DEN_TSX) $(DEN_ENGINE)/scripts/setup-secrets.ts --gate; then \
|
|
19
|
+
echo ""; \
|
|
20
|
+
echo "🔑 secrets.required is set and the secrets backend is not ready."; \
|
|
21
|
+
echo ""; \
|
|
22
|
+
$(MAKE) $(DEN_TARGET_PREFIX)-setup-secrets || exit 1; \
|
|
23
|
+
fi
|
|
24
|
+
@$(DEN_BIN) up $(args)
|
|
25
|
+
|
|
26
|
+
# Stop services in the active workspace. `make down` is the short form most
|
|
27
|
+
# people reach for, so it stops SERVICES; use `make test-down` for Playwright/k6.
|
|
28
|
+
# Usage: make down OR make down args="files-api -w files-api"
|
|
29
|
+
down $(DEN_TARGET_PREFIX)-down:
|
|
30
|
+
@$(DEN_BIN) down $(args)
|
|
31
|
+
|
|
32
|
+
$(DEN_TARGET_PREFIX)-restart:
|
|
33
|
+
@$(DEN_BIN) restart $(args)
|
|
34
|
+
|
|
35
|
+
$(DEN_TARGET_PREFIX)-status:
|
|
36
|
+
@$(DEN_BIN) status
|
|
37
|
+
|
|
38
|
+
# Tail live local logs for a repo's service (offers to start it when down).
|
|
39
|
+
# Usage: make $(DEN_TARGET_PREFIX)-logs OR make $(DEN_TARGET_PREFIX)-logs args="shop"
|
|
40
|
+
$(DEN_TARGET_PREFIX)-logs:
|
|
41
|
+
@$(DEN_BIN) logs $(args)
|
|
42
|
+
|
|
43
|
+
$(DEN_TARGET_PREFIX)-services:
|
|
44
|
+
@$(DEN_BIN) services
|
|
45
|
+
|
|
46
|
+
# Derive and show the system dependency graph.
|
|
47
|
+
# Usage: make $(DEN_TARGET_PREFIX)-graph OR make $(DEN_TARGET_PREFIX)-graph args="--all --diff"
|
|
48
|
+
$(DEN_TARGET_PREFIX)-graph:
|
|
49
|
+
@$(DEN_BIN) graph $(args)
|
|
50
|
+
|
|
51
|
+
# Check for updates and pull managed repos.
|
|
52
|
+
$(DEN_TARGET_PREFIX)-sync:
|
|
53
|
+
@$(DEN_BIN) sync $(args)
|
|
54
|
+
|
|
55
|
+
# ── Workspaces ────────────────────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
# Usage: make $(DEN_TARGET_PREFIX)-workspace args="list"
|
|
58
|
+
# make $(DEN_TARGET_PREFIX)-workspace args="use feat-streaming"
|
|
59
|
+
# make $(DEN_TARGET_PREFIX)-workspace args="create feat-streaming"
|
|
60
|
+
$(DEN_TARGET_PREFIX)-workspace:
|
|
61
|
+
@$(DEN_BIN) workspace $(args)
|
|
62
|
+
|
|
63
|
+
# ── Catalog & repo setup ──────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
# Register a repo in the service catalog (interactive).
|
|
66
|
+
# Usage: make $(DEN_TARGET_PREFIX)-register OR make $(DEN_TARGET_PREFIX)-register args=/path/to/repo
|
|
67
|
+
$(DEN_TARGET_PREFIX)-register:
|
|
68
|
+
@$(DEN_BIN) register $(args)
|
|
69
|
+
|
|
70
|
+
# Run setup for registered services.
|
|
71
|
+
# Usage: make $(DEN_TARGET_PREFIX)-setup OR make $(DEN_TARGET_PREFIX)-setup args="shop tasks-runner"
|
|
72
|
+
$(DEN_TARGET_PREFIX)-setup:
|
|
73
|
+
@$(DEN_BIN) setup $(args)
|
|
74
|
+
|
|
75
|
+
# Scaffold a new .den.yml in a target directory (interactive).
|
|
76
|
+
# Usage: make $(DEN_TARGET_PREFIX)-init OR make $(DEN_TARGET_PREFIX)-init args=/path/to/repo
|
|
77
|
+
$(DEN_TARGET_PREFIX)-init:
|
|
78
|
+
@$(DEN_BIN) init $(args)
|
|
79
|
+
|
|
80
|
+
# Heal config/den.yml — fills missing required keys (currently github_org).
|
|
81
|
+
# Idempotent. Safe for existing users whose den.yml pre-dates github_org.
|
|
82
|
+
$(DEN_TARGET_PREFIX)-heal-config:
|
|
83
|
+
@$(DEN_TSX) $(DEN_ENGINE)/scripts/heal-config.ts
|
|
84
|
+
|
|
85
|
+
# Validate a .den.yml file or URL.
|
|
86
|
+
# Usage: make $(DEN_TARGET_PREFIX)-validate args=/path/to/repo
|
|
87
|
+
# make $(DEN_TARGET_PREFIX)-validate args=/path/to/repo/.den.yml
|
|
88
|
+
$(DEN_TARGET_PREFIX)-validate:
|
|
89
|
+
@$(DEN_BIN) validate $(args)
|
|
90
|
+
|
|
91
|
+
# Toggle the local dev experience on or off (per-engineer, gitignored).
|
|
92
|
+
# Usage: make $(DEN_TARGET_PREFIX)-local-dev args=on|off
|
|
93
|
+
$(DEN_TARGET_PREFIX)-local-dev:
|
|
94
|
+
@$(DEN_BIN) local-dev $(args)
|
|
95
|
+
|
|
96
|
+
# Set up developer secrets with the configured backend (secrets.provider).
|
|
97
|
+
$(DEN_TARGET_PREFIX)-setup-secrets:
|
|
98
|
+
@$(DEN_TSX) $(DEN_ENGINE)/scripts/setup-secrets.ts
|
|
99
|
+
|
|
100
|
+
# 1Password strategy only: populate the "Developer API Keys" item.
|
|
101
|
+
$(DEN_TARGET_PREFIX)-setup-1password:
|
|
102
|
+
@$(DEN_TSX) $(DEN_ENGINE)/scripts/setup-1password.ts
|
|
103
|
+
|
|
104
|
+
# Show where test discovery gets its repos. With Local Dev enabled (default)
|
|
105
|
+
# it follows the workspace — nothing to register. Hosted / no-local setups get
|
|
106
|
+
# the legacy sibling scan (also forceable with args=--legacy), which writes
|
|
107
|
+
# config/local/registered-repos.json (gitignored).
|
|
108
|
+
register-repos:
|
|
109
|
+
@$(DEN_TSX) $(DEN_ENGINE)/src/scripts/register-repos.ts $(args)
|
|
110
|
+
|
|
111
|
+
# Map den environments → AWS CLI profiles for CloudWatch logs and re-auth.
|
|
112
|
+
# Writes to config/local/aws-profiles.json (gitignored).
|
|
113
|
+
aws-configure:
|
|
114
|
+
@$(DEN_TSX) $(DEN_ENGINE)/src/scripts/configure-aws-profiles.ts
|
|
115
|
+
|
|
116
|
+
# Per-engineer admin 1Password setup — staging/production only.
|
|
117
|
+
# Saves config/local/admin-auth-{env}.json (gitignored, no password stored).
|
|
118
|
+
auth-configure:
|
|
119
|
+
@E2E_ENVIRONMENT=$(env) $(DEN_TSX) $(DEN_ENGINE)/scripts/auth-configure.ts
|
|
120
|
+
@$(MAKE) int-jwt-clear env=$(env)
|
|
121
|
+
|
|
122
|
+
# ── Web UI ────────────────────────────────────────────────────────────────────
|
|
123
|
+
|
|
124
|
+
# Browser-based runner + Local Dev dashboard at http://localhost:<web.port> (default 7777),
|
|
125
|
+
# and https://<brand>.<edge.domain> once `edge up` has run. Never opens a browser:
|
|
126
|
+
# it prints the address instead.
|
|
127
|
+
# PORT=8080 make web — run on a different port.
|
|
128
|
+
# make web silent=true — suppress request logs (banner still shown).
|
|
129
|
+
web:
|
|
130
|
+
@if ! $(DEN_TSX) $(DEN_ENGINE)/scripts/setup-secrets.ts --gate; then \
|
|
131
|
+
echo ""; \
|
|
132
|
+
echo "🔑 secrets.required is set and the secrets backend is not ready."; \
|
|
133
|
+
echo ""; \
|
|
134
|
+
$(MAKE) $(DEN_TARGET_PREFIX)-setup-secrets || exit 1; \
|
|
135
|
+
fi
|
|
136
|
+
@echo "🌐 Starting the web UI..."
|
|
137
|
+
@_PORT=$${PORT:-$$($(DEN_TSX) -e 'import("$(DEN_ENGINE)/src/shared/edge/config.ts").then(m=>console.log(m.readWebPort()))' 2>/dev/null || echo 7777)}; \
|
|
138
|
+
_HOST=$$(grep -q "127.0.0.1 den" /etc/hosts 2>/dev/null && echo "den" || echo "localhost"); \
|
|
139
|
+
_SILENT_FLAG=$$([ "$(silent)" = "true" ] && echo "--silent" || echo ""); \
|
|
140
|
+
echo " http://$$_HOST:$$_PORT"; \
|
|
141
|
+
$(DEN_TSX) $(DEN_ENGINE)/src/ui/server/index.ts $$_SILENT_FLAG
|
|
142
|
+
|
|
143
|
+
# OPTIONAL, legacy: add a bare 'den' alias to /etc/hosts (needs sudo) so
|
|
144
|
+
# http://den:7777 resolves. Not needed — http://den.localhost:7777
|
|
145
|
+
# already resolves in Chromium/Firefox, and http://localhost:7777 everywhere.
|
|
146
|
+
# Requires sudo.
|
|
147
|
+
dev-dns:
|
|
148
|
+
@if grep -q "127.0.0.1 den" /etc/hosts 2>/dev/null; then \
|
|
149
|
+
echo "✅ /etc/hosts already has '127.0.0.1 den'"; \
|
|
150
|
+
else \
|
|
151
|
+
echo "Adding '127.0.0.1 den' to /etc/hosts (requires sudo)..."; \
|
|
152
|
+
echo '127.0.0.1 den' | sudo tee -a /etc/hosts > /dev/null; \
|
|
153
|
+
echo "✅ Done. You can now use http://den:7777"; \
|
|
154
|
+
fi
|
package/make/security.mk
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# make/security.mk — OWASP ZAP scanning of our own services (security pillar)
|
|
2
|
+
#
|
|
3
|
+
# Scan targets are declared in each workspace repo's .den.yml (or the
|
|
4
|
+
# den-held manifests/<repo>.den.yml) under `security:`; the runner
|
|
5
|
+
# drives ZAP in docker. Every target host must be on the owned-host allowlist
|
|
6
|
+
# (config/den.yml `security.owned_hosts`). See src/pillars/security/.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# make test-sec-all env=<env> Every target, baseline mode
|
|
10
|
+
# make test-sec-<service> env=<env> One service (bare name)
|
|
11
|
+
# make test-sec-<service> env=<env> repo=<repo> Repo-qualified (--service=<repo>/<service>)
|
|
12
|
+
# make test-sec-all env=<env> mode=<m> m = baseline | api | full | all
|
|
13
|
+
# make test-sec-all env=<env> dry_run=1 Print the docker commands only
|
|
14
|
+
#
|
|
15
|
+
# Production is passive-only (baseline) and additionally needs
|
|
16
|
+
# DEN_ALLOW_PROD=1; the runner enforces both — this file only guards env.
|
|
17
|
+
#
|
|
18
|
+
# The root Makefile sets a global `repo ?= shop` default for the smoke
|
|
19
|
+
# pillar. Security deliberately ignores that inherited default — only a
|
|
20
|
+
# `repo=` stated on the command line ($(origin repo) == "command line")
|
|
21
|
+
# qualifies the service name.
|
|
22
|
+
#
|
|
23
|
+
# EXPLICIT-ENV GUARD: the root Makefile sets `env ?= local`, which would
|
|
24
|
+
# silently point scans at local. Scans send attack traffic, so the env MUST
|
|
25
|
+
# be stated on the command line — $(origin env) is "command line" only then;
|
|
26
|
+
# "file" (the ?= default) and "environment" (an inherited shell var) are
|
|
27
|
+
# both rejected.
|
|
28
|
+
|
|
29
|
+
.PHONY: test-sec-all .security-check-env
|
|
30
|
+
|
|
31
|
+
# Optional pass-through flags (only when stated on the command line)
|
|
32
|
+
SEC_FLAGS := $(if $(filter command line,$(origin mode)),--mode=$(mode)) \
|
|
33
|
+
$(if $(filter command line,$(origin dry_run)),--dry-run)
|
|
34
|
+
|
|
35
|
+
.security-check-env:
|
|
36
|
+
ifeq ($(origin env),command line)
|
|
37
|
+
@true
|
|
38
|
+
else
|
|
39
|
+
@echo "❌ Security scans require an explicit env=<name> on the command line."
|
|
40
|
+
@echo " The Makefile default (env ?= local) is deliberately rejected for"
|
|
41
|
+
@echo " scans that send attack traffic. Usage: make test-sec-all env=local"
|
|
42
|
+
@exit 1
|
|
43
|
+
endif
|
|
44
|
+
|
|
45
|
+
# Every discovered target allowed in $(env)
|
|
46
|
+
test-sec-all: .security-check-env
|
|
47
|
+
@echo "🛡️ Running ALL security scans..."
|
|
48
|
+
@echo "🌍 Environment: $(env)"
|
|
49
|
+
@echo ""
|
|
50
|
+
@$(DEN_TSX) $(DEN_ENGINE)/src/pillars/security/run.ts --env=$(env) $(SEC_FLAGS)
|
|
51
|
+
|
|
52
|
+
# make test-sec-<service> env=<env> [repo=<repo>]
|
|
53
|
+
test-sec-%: .security-check-env
|
|
54
|
+
@SERVICE_NAME=$(subst test-sec-,,$@); \
|
|
55
|
+
$(if $(filter command line,$(origin repo)),SERVICE_NAME="$(repo)/$$SERVICE_NAME";) \
|
|
56
|
+
echo "🛡️ Running security scan for $$SERVICE_NAME..."; \
|
|
57
|
+
echo "🌍 Environment: $(env)"; \
|
|
58
|
+
echo ""; \
|
|
59
|
+
$(DEN_TSX) $(DEN_ENGINE)/src/pillars/security/run.ts --env=$(env) --service=$$SERVICE_NAME $(SEC_FLAGS)
|