delimit-cli 4.1.53 → 4.2.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 +26 -0
- package/bin/delimit-cli.js +1 -2
- package/bin/delimit-setup.js +22 -7
- package/gateway/ai/agent_dispatch.py +79 -0
- package/gateway/ai/daily_digest.py +386 -0
- package/gateway/ai/ledger_manager.py +32 -0
- package/gateway/ai/license_core.py +2 -0
- package/gateway/ai/notify.py +17 -11
- package/gateway/ai/reddit_proxy.py +28 -9
- package/gateway/ai/sensing/__init__.py +35 -0
- package/gateway/ai/sensing/schema.py +107 -0
- package/gateway/ai/sensing/signal_store.py +348 -0
- package/gateway/ai/server.py +419 -6
- package/gateway/ai/supabase_sync.py +308 -0
- package/gateway/ai/work_order.py +216 -0
- package/gateway/ai/workers/__init__.py +32 -0
- package/gateway/ai/workers/base.py +154 -0
- package/gateway/ai/workers/executor.py +861 -0
- package/gateway/ai/workers/outreach_drafter.py +161 -0
- package/gateway/ai/workers/pr_drafter.py +148 -0
- package/package.json +14 -1
- package/gateway/ai/continuity.py +0 -462
- package/gateway/ai/inbox_daemon_runner.py +0 -217
- package/gateway/ai/loop_engine.py +0 -1303
- package/gateway/ai/social_cache.py +0 -341
- package/gateway/ai/social_daemon.py +0 -483
- package/gateway/ai/tweet_corpus_schema.sql +0 -76
- package/scripts/crosspost_devto.py +0 -304
- package/scripts/demo-v420-clean.sh +0 -267
- package/scripts/demo-v420-deliberation.sh +0 -217
- package/scripts/demo-v420.sh +0 -55
- package/scripts/sync-gateway.sh +0 -112
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# v4.20 Demo — Ledger + Multi-Model Deliberation
|
|
3
|
-
# Shows the "think and build" loop that no competitor has
|
|
4
|
-
|
|
5
|
-
set -e
|
|
6
|
-
|
|
7
|
-
export HOME=/tmp/delimit-demo-home
|
|
8
|
-
export DELIMIT_MODEL=cli
|
|
9
|
-
rm -rf "$HOME" 2>/dev/null
|
|
10
|
-
mkdir -p "$HOME/.delimit/memory" "$HOME/.delimit/evidence" "$HOME/.delimit/ledger" "$HOME/.delimit/sessions" "$HOME/.delimit/server/ai"
|
|
11
|
-
|
|
12
|
-
CLI="node /home/delimit/npm-delimit/bin/delimit-cli.js"
|
|
13
|
-
|
|
14
|
-
# ── Seed a rich ledger ───────────────────────────────────────────────
|
|
15
|
-
cat > "$HOME/.delimit/ledger/ops.jsonl" << 'LEDGER'
|
|
16
|
-
{"id":"LED-001","title":"Add rate limiting to /users endpoint","type":"feat","priority":"P0","status":"in_progress","created_at":"2026-04-01T10:00:00Z","description":"Free tier: 100 req/min. Pro tier: 1000 req/min. Use Redis sliding window."}
|
|
17
|
-
{"id":"LED-002","title":"Fix pagination cursor bug in /orders","type":"fix","priority":"P0","status":"open","created_at":"2026-04-02T14:00:00Z","description":"Cursor-based pagination returns duplicate rows when items are deleted mid-page."}
|
|
18
|
-
{"id":"LED-003","title":"Migrate auth from sessions to JWT","type":"feat","priority":"P1","status":"open","created_at":"2026-04-03T09:00:00Z","description":"15-min access tokens, 7-day refresh. Must not break mobile clients."}
|
|
19
|
-
{"id":"LED-004","title":"Add OpenTelemetry tracing to all endpoints","type":"feat","priority":"P2","status":"open","created_at":"2026-04-03T11:00:00Z"}
|
|
20
|
-
{"id":"LED-005","title":"Deprecate v1 webhook format","type":"task","priority":"P1","status":"open","created_at":"2026-04-04T08:00:00Z","description":"Send sunset header for 30 days, then remove."}
|
|
21
|
-
{"id":"LED-006","title":"Security audit: dependency CVE scan","type":"task","priority":"P0","status":"open","created_at":"2026-04-04T16:00:00Z"}
|
|
22
|
-
LEDGER
|
|
23
|
-
|
|
24
|
-
cat > "$HOME/.delimit/ledger/strategy.jsonl" << 'STRATEGY'
|
|
25
|
-
{"id":"STR-001","title":"Evaluate GraphQL federation vs REST gateway","type":"strategy","priority":"P1","status":"open","created_at":"2026-04-01T10:00:00Z","description":"Mobile team wants GraphQL. Backend team prefers REST. Need consensus."}
|
|
26
|
-
{"id":"STR-002","title":"Competitor launched rate limiting as a service","type":"strategy","priority":"P1","status":"open","created_at":"2026-04-03T15:00:00Z","description":"Competitor X launched managed rate limiting. Do we build or buy?"}
|
|
27
|
-
STRATEGY
|
|
28
|
-
|
|
29
|
-
# ── Seed memories ────────────────────────────────────────────────────
|
|
30
|
-
$CLI remember "PostgreSQL is primary DB, Redis for rate limiting and sessions" --tag postgres --tag redis 2>/dev/null || true
|
|
31
|
-
$CLI remember "Mobile clients still on v1 webhooks — 30-day sunset required" --tag webhooks --tag mobile 2>/dev/null || true
|
|
32
|
-
$CLI remember "Last security audit was 6 weeks ago — overdue" --tag security 2>/dev/null || true
|
|
33
|
-
$CLI remember "Architecture decision: event sourcing for audit trail" --tag architecture 2>/dev/null || true
|
|
34
|
-
$CLI remember "JWT migration must not break iOS app — coordinate with mobile team" --tag jwt --tag mobile 2>/dev/null || true
|
|
35
|
-
|
|
36
|
-
# ── Seed models config ───────────────────────────────────────────────
|
|
37
|
-
cat > "$HOME/.delimit/models.json" << 'MODELS'
|
|
38
|
-
{
|
|
39
|
-
"claude": { "api_key": "sk-ant-demo", "enabled": true },
|
|
40
|
-
"gemini": { "api_key": "AIza-demo", "enabled": true },
|
|
41
|
-
"codex": { "api_key": "sk-demo", "enabled": true },
|
|
42
|
-
"grok": { "api_key": "xai-demo", "enabled": true }
|
|
43
|
-
}
|
|
44
|
-
MODELS
|
|
45
|
-
|
|
46
|
-
# ── Seed MCP + license ───────────────────────────────────────────────
|
|
47
|
-
cat > "$HOME/.mcp.json" << 'MCP'
|
|
48
|
-
{"mcpServers":{"delimit":{"command":"python3","args":["server.py"]}}}
|
|
49
|
-
MCP
|
|
50
|
-
cat > "$HOME/.delimit/server/ai/server.py" << 'SRV'
|
|
51
|
-
@mcp.tool
|
|
52
|
-
def delimit_lint(): pass
|
|
53
|
-
@mcp.tool
|
|
54
|
-
def delimit_deliberate(): pass
|
|
55
|
-
@mcp.tool
|
|
56
|
-
def delimit_ledger(): pass
|
|
57
|
-
SRV
|
|
58
|
-
cat > "$HOME/.delimit/license.json" << 'LIC'
|
|
59
|
-
{"tier": "Pro", "status": "active", "email": "team@acme.dev"}
|
|
60
|
-
LIC
|
|
61
|
-
|
|
62
|
-
# ── Seed evidence ────────────────────────────────────────────────────
|
|
63
|
-
for i in 1 2 3 4 5 6 7 8; do
|
|
64
|
-
echo "{\"type\":\"evidence_collected\",\"timestamp\":\"2026-04-0${i}T12:00:00Z\",\"project\":\"/projects/acme-api\",\"checks_passed\":true}" >> "$HOME/.delimit/evidence/events.jsonl"
|
|
65
|
-
done
|
|
66
|
-
|
|
67
|
-
# ── Seed session ─────────────────────────────────────────────────────
|
|
68
|
-
cat > "$HOME/.delimit/sessions/session_20260405_100000.json" << 'SESS'
|
|
69
|
-
{"summary":"Rate limiting implementation + security audit prep","created_at":"2026-04-05T10:00:00Z"}
|
|
70
|
-
SESS
|
|
71
|
-
|
|
72
|
-
# ── Create demo project ──────────────────────────────────────────────
|
|
73
|
-
DEMO_DIR=/tmp/delimit-demo-project
|
|
74
|
-
rm -rf "$DEMO_DIR"
|
|
75
|
-
mkdir -p "$DEMO_DIR/.delimit" "$DEMO_DIR/.git/hooks" "$DEMO_DIR/.github/workflows"
|
|
76
|
-
cd "$DEMO_DIR"
|
|
77
|
-
git init -q .
|
|
78
|
-
git config user.email "dev@acme.dev"
|
|
79
|
-
git config user.name "Acme Dev"
|
|
80
|
-
|
|
81
|
-
cat > openapi.yaml << 'SPEC'
|
|
82
|
-
openapi: "3.0.0"
|
|
83
|
-
info:
|
|
84
|
-
title: Acme API
|
|
85
|
-
version: 2.1.0
|
|
86
|
-
paths:
|
|
87
|
-
/users:
|
|
88
|
-
get:
|
|
89
|
-
operationId: listUsers
|
|
90
|
-
summary: List users
|
|
91
|
-
responses:
|
|
92
|
-
"200":
|
|
93
|
-
description: OK
|
|
94
|
-
/orders:
|
|
95
|
-
get:
|
|
96
|
-
operationId: listOrders
|
|
97
|
-
summary: List orders
|
|
98
|
-
responses:
|
|
99
|
-
"200":
|
|
100
|
-
description: OK
|
|
101
|
-
SPEC
|
|
102
|
-
|
|
103
|
-
cat > .delimit/policies.yml << 'POL'
|
|
104
|
-
name: acme-governance
|
|
105
|
-
preset: default
|
|
106
|
-
enforcement_mode: enforce
|
|
107
|
-
rules:
|
|
108
|
-
no-breaking-changes:
|
|
109
|
-
severity: error
|
|
110
|
-
require-descriptions:
|
|
111
|
-
severity: warn
|
|
112
|
-
POL
|
|
113
|
-
|
|
114
|
-
echo "# delimit-governance-hook" > .git/hooks/pre-commit
|
|
115
|
-
chmod +x .git/hooks/pre-commit
|
|
116
|
-
echo "uses: delimit-ai/delimit-action@v1" > .github/workflows/api-governance.yml
|
|
117
|
-
git add -A && git commit -q -m "initial"
|
|
118
|
-
|
|
119
|
-
# ── Typing effect ────────────────────────────────────────────────────
|
|
120
|
-
type_cmd() {
|
|
121
|
-
echo ""
|
|
122
|
-
echo -n "$ "
|
|
123
|
-
for ((i=0; i<${#1}; i++)); do
|
|
124
|
-
echo -n "${1:$i:1}"
|
|
125
|
-
sleep 0.04
|
|
126
|
-
done
|
|
127
|
-
echo ""
|
|
128
|
-
sleep 0.3
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
# ── Mock deliberation output ─────────────────────────────────────────
|
|
132
|
-
mock_deliberation() {
|
|
133
|
-
echo ""
|
|
134
|
-
echo " Delimit Deliberate"
|
|
135
|
-
echo ""
|
|
136
|
-
echo " Question: Should we build rate limiting in-house or use a managed service?"
|
|
137
|
-
echo " Models: Claude + Gemini + Codex + Grok"
|
|
138
|
-
echo ""
|
|
139
|
-
sleep 1
|
|
140
|
-
echo " Round 1 (independent):"
|
|
141
|
-
sleep 0.5
|
|
142
|
-
echo " Claude: Build in-house. Redis sliding window is 50 lines."
|
|
143
|
-
echo " Managed service adds latency + vendor lock-in."
|
|
144
|
-
sleep 1
|
|
145
|
-
echo " Gemini: Build. You already have Redis. The complexity is"
|
|
146
|
-
echo " in the policy, not the counter."
|
|
147
|
-
sleep 1
|
|
148
|
-
echo " Codex: Agree — build. But add circuit breaker for Redis"
|
|
149
|
-
echo " failures so rate limiting degrades gracefully."
|
|
150
|
-
sleep 1
|
|
151
|
-
echo " Grok: Build. Managed services charge per request."
|
|
152
|
-
echo " At your scale that's \$200/mo for a 50-line feature."
|
|
153
|
-
sleep 1.5
|
|
154
|
-
echo ""
|
|
155
|
-
echo " Round 2 (deliberation):"
|
|
156
|
-
sleep 0.5
|
|
157
|
-
echo " All models: AGREE — build in-house with Redis sliding window."
|
|
158
|
-
echo " Key addition: circuit breaker for Redis failures (Codex)."
|
|
159
|
-
sleep 1.5
|
|
160
|
-
echo ""
|
|
161
|
-
echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
162
|
-
echo " UNANIMOUS CONSENSUS (2 rounds)"
|
|
163
|
-
echo " Confidence: 94/100"
|
|
164
|
-
echo ""
|
|
165
|
-
echo " Verdict: Build rate limiting in-house using Redis"
|
|
166
|
-
echo " sliding window. Add circuit breaker for Redis failures."
|
|
167
|
-
echo " Estimated complexity: small (50 LOC + tests)."
|
|
168
|
-
echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
169
|
-
echo ""
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
# ══════════════════════════════════════════════════════════════════════
|
|
173
|
-
# DEMO START
|
|
174
|
-
# ══════════════════════════════════════════════════════════════════════
|
|
175
|
-
|
|
176
|
-
clear
|
|
177
|
-
echo ""
|
|
178
|
-
echo " Delimit v4.20 — Think and Build"
|
|
179
|
-
echo " Multi-model deliberation + persistent ledger"
|
|
180
|
-
echo ""
|
|
181
|
-
sleep 2
|
|
182
|
-
|
|
183
|
-
# 1. Show the status dashboard
|
|
184
|
-
type_cmd "delimit status"
|
|
185
|
-
$CLI status 2>/dev/null
|
|
186
|
-
sleep 4
|
|
187
|
-
|
|
188
|
-
# 2. Show the report with ledger items
|
|
189
|
-
type_cmd "delimit report --since 7d"
|
|
190
|
-
$CLI report --since 7d 2>/dev/null
|
|
191
|
-
sleep 5
|
|
192
|
-
|
|
193
|
-
# 3. Run a deliberation
|
|
194
|
-
type_cmd "delimit deliberate 'Should we build rate limiting in-house or use a managed service?'"
|
|
195
|
-
mock_deliberation
|
|
196
|
-
sleep 4
|
|
197
|
-
|
|
198
|
-
# 4. Remember the decision
|
|
199
|
-
type_cmd "delimit remember 'Consensus: build rate limiting in-house with Redis sliding window + circuit breaker'"
|
|
200
|
-
$CLI remember 'Consensus: build rate limiting in-house with Redis sliding window + circuit breaker' --tag redis --tag architecture 2>/dev/null
|
|
201
|
-
sleep 2
|
|
202
|
-
|
|
203
|
-
# 5. Recall to show it persists
|
|
204
|
-
type_cmd "delimit recall rate limiting"
|
|
205
|
-
$CLI recall "rate limiting" 2>/dev/null
|
|
206
|
-
sleep 3
|
|
207
|
-
|
|
208
|
-
echo ""
|
|
209
|
-
echo " 4 models. 1 consensus. 0 meetings."
|
|
210
|
-
echo ""
|
|
211
|
-
echo " npm i -g delimit-cli"
|
|
212
|
-
echo " github.com/delimit-ai/delimit-mcp-server"
|
|
213
|
-
echo ""
|
|
214
|
-
sleep 4
|
|
215
|
-
|
|
216
|
-
# Cleanup
|
|
217
|
-
rm -rf "$DEMO_DIR" /tmp/delimit-demo-home
|
package/scripts/demo-v420.sh
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# v4.20 Demo Script — recorded via asciinema for YouTube Short + GIF
|
|
3
|
-
# Shows: doctor → simulate → status → report flow
|
|
4
|
-
# Each command has a pause so the viewer can read the output
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
# Simulated typing effect
|
|
9
|
-
type_cmd() {
|
|
10
|
-
echo ""
|
|
11
|
-
echo -n "$ "
|
|
12
|
-
for ((i=0; i<${#1}; i++)); do
|
|
13
|
-
echo -n "${1:$i:1}"
|
|
14
|
-
sleep 0.04
|
|
15
|
-
done
|
|
16
|
-
echo ""
|
|
17
|
-
sleep 0.3
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
clear
|
|
21
|
-
echo ""
|
|
22
|
-
echo " Delimit v4.20 — The Highest State of AI Governance"
|
|
23
|
-
echo " ─────────────────────────────────────────────────────"
|
|
24
|
-
echo ""
|
|
25
|
-
sleep 2
|
|
26
|
-
|
|
27
|
-
# 1. Doctor
|
|
28
|
-
type_cmd "delimit doctor"
|
|
29
|
-
delimit doctor 2>/dev/null || node /home/delimit/npm-delimit/bin/delimit-cli.js doctor 2>/dev/null
|
|
30
|
-
sleep 3
|
|
31
|
-
|
|
32
|
-
# 2. Simulate
|
|
33
|
-
type_cmd "delimit simulate"
|
|
34
|
-
delimit simulate 2>/dev/null || node /home/delimit/npm-delimit/bin/delimit-cli.js simulate 2>/dev/null
|
|
35
|
-
sleep 3
|
|
36
|
-
|
|
37
|
-
# 3. Status
|
|
38
|
-
type_cmd "delimit status"
|
|
39
|
-
delimit status 2>/dev/null || node /home/delimit/npm-delimit/bin/delimit-cli.js status 2>/dev/null
|
|
40
|
-
sleep 3
|
|
41
|
-
|
|
42
|
-
# 4. Report
|
|
43
|
-
type_cmd "delimit report --since 7d"
|
|
44
|
-
delimit report --since 7d 2>/dev/null || node /home/delimit/npm-delimit/bin/delimit-cli.js report --since 7d 2>/dev/null
|
|
45
|
-
sleep 3
|
|
46
|
-
|
|
47
|
-
# 5. Remember
|
|
48
|
-
type_cmd "delimit remember 'v4.20 demo recorded successfully'"
|
|
49
|
-
delimit remember 'v4.20 demo recorded successfully' 2>/dev/null || node /home/delimit/npm-delimit/bin/delimit-cli.js remember 'v4.20 demo recorded successfully' 2>/dev/null
|
|
50
|
-
sleep 2
|
|
51
|
-
|
|
52
|
-
echo ""
|
|
53
|
-
echo " npm i -g delimit-cli@4.20.0"
|
|
54
|
-
echo ""
|
|
55
|
-
sleep 3
|
package/scripts/sync-gateway.sh
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Sync gateway Python files into npm bundle before publish.
|
|
3
|
-
# Source of truth: /home/delimit/delimit-gateway/
|
|
4
|
-
# Destination: ./gateway/ (relative to npm-delimit root)
|
|
5
|
-
#
|
|
6
|
-
# This runs as part of prepublishOnly to guarantee the npm package
|
|
7
|
-
# always contains the latest gateway code. Drift is impossible.
|
|
8
|
-
|
|
9
|
-
set -euo pipefail
|
|
10
|
-
|
|
11
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
12
|
-
NPM_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
13
|
-
GATEWAY_SRC="${GATEWAY_OVERRIDE:-/home/delimit/delimit-gateway}"
|
|
14
|
-
|
|
15
|
-
# ── Verify gateway source exists ─────────────────────────────────────
|
|
16
|
-
if [ ! -d "$GATEWAY_SRC/ai" ]; then
|
|
17
|
-
echo "⚠️ Gateway source not found at $GATEWAY_SRC"
|
|
18
|
-
echo " Skipping sync (CI or customer machine — bundle as-is)"
|
|
19
|
-
exit 0
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
echo "🔄 Syncing gateway → npm bundle..."
|
|
23
|
-
|
|
24
|
-
# ── Proprietary files to EXCLUDE from npm bundle ─────────────────────
|
|
25
|
-
# These are Pro-only or internal and must never ship in the public package
|
|
26
|
-
EXCLUDE=(
|
|
27
|
-
"social_target.py"
|
|
28
|
-
"social.py"
|
|
29
|
-
"founding_users.py"
|
|
30
|
-
"inbox_daemon.py"
|
|
31
|
-
"deliberation.py"
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
# ── Sync ai/ directory ───────────────────────────────────────────────
|
|
35
|
-
rsync -a --delete \
|
|
36
|
-
--exclude='__pycache__' \
|
|
37
|
-
--exclude='*.pyc' \
|
|
38
|
-
"$GATEWAY_SRC/ai/" "$NPM_ROOT/gateway/ai/"
|
|
39
|
-
|
|
40
|
-
# ── Remove proprietary files that rsync copied ───────────────────────
|
|
41
|
-
for f in "${EXCLUDE[@]}"; do
|
|
42
|
-
rm -f "$NPM_ROOT/gateway/ai/$f"
|
|
43
|
-
done
|
|
44
|
-
|
|
45
|
-
# ── Sync core/ directory ─────────────────────────────────────────────
|
|
46
|
-
rsync -a --delete \
|
|
47
|
-
--exclude='__pycache__' \
|
|
48
|
-
--exclude='*.pyc' \
|
|
49
|
-
"$GATEWAY_SRC/core/" "$NPM_ROOT/gateway/core/"
|
|
50
|
-
|
|
51
|
-
# ── Sync tasks/ directory ────────────────────────────────────────────
|
|
52
|
-
rsync -a --delete \
|
|
53
|
-
--exclude='__pycache__' \
|
|
54
|
-
--exclude='*.pyc' \
|
|
55
|
-
"$GATEWAY_SRC/tasks/" "$NPM_ROOT/gateway/tasks/"
|
|
56
|
-
|
|
57
|
-
# ── Sync requirements.txt ────────────────────────────────────────────
|
|
58
|
-
cp "$GATEWAY_SRC/requirements.txt" "$NPM_ROOT/gateway/requirements.txt" 2>/dev/null || true
|
|
59
|
-
|
|
60
|
-
# ── Also sync to installed server (if present) ────────────────────────
|
|
61
|
-
# Skip with SKIP_SERVER_SYNC=1 to avoid disconnecting active MCP sessions
|
|
62
|
-
INSTALLED_SERVER="$HOME/.delimit/server"
|
|
63
|
-
if [ "${SKIP_SERVER_SYNC:-}" = "1" ]; then
|
|
64
|
-
echo " ⏭️ Skipping installed server sync (SKIP_SERVER_SYNC=1)"
|
|
65
|
-
elif [ -d "$INSTALLED_SERVER/ai" ]; then
|
|
66
|
-
echo " Syncing to installed server ($INSTALLED_SERVER)..."
|
|
67
|
-
rsync -a --delete \
|
|
68
|
-
--exclude='__pycache__' \
|
|
69
|
-
--exclude='*.pyc' \
|
|
70
|
-
"$GATEWAY_SRC/ai/" "$INSTALLED_SERVER/ai/"
|
|
71
|
-
rsync -a --delete \
|
|
72
|
-
--exclude='__pycache__' \
|
|
73
|
-
--exclude='*.pyc' \
|
|
74
|
-
"$GATEWAY_SRC/core/" "$INSTALLED_SERVER/core/" 2>/dev/null || true
|
|
75
|
-
echo " ✅ installed server synced"
|
|
76
|
-
fi
|
|
77
|
-
|
|
78
|
-
# ── Report ────────────────────────────────────────────────────────────
|
|
79
|
-
AI_COUNT=$(find "$NPM_ROOT/gateway/ai" -name '*.py' -not -name '__pycache__' | wc -l)
|
|
80
|
-
CORE_COUNT=$(find "$NPM_ROOT/gateway/core" -name '*.py' -not -name '__pycache__' | wc -l)
|
|
81
|
-
TASKS_COUNT=$(find "$NPM_ROOT/gateway/tasks" -name '*.py' -not -name '__pycache__' | wc -l)
|
|
82
|
-
|
|
83
|
-
echo " ✅ ai/: $AI_COUNT files"
|
|
84
|
-
echo " ✅ core/: $CORE_COUNT files"
|
|
85
|
-
echo " ✅ tasks/: $TASKS_COUNT files"
|
|
86
|
-
|
|
87
|
-
# ── Verify no proprietary files leaked ────────────────────────────────
|
|
88
|
-
LEAKED=0
|
|
89
|
-
for f in "${EXCLUDE[@]}"; do
|
|
90
|
-
if [ -f "$NPM_ROOT/gateway/ai/$f" ]; then
|
|
91
|
-
echo " ❌ PROPRIETARY FILE LEAKED: $f"
|
|
92
|
-
LEAKED=1
|
|
93
|
-
fi
|
|
94
|
-
done
|
|
95
|
-
if [ $LEAKED -ne 0 ]; then
|
|
96
|
-
echo "❌ Sync failed — proprietary files in bundle"
|
|
97
|
-
exit 1
|
|
98
|
-
fi
|
|
99
|
-
|
|
100
|
-
# ── Run credential scan on synced gateway files ─────────────────────
|
|
101
|
-
echo -n " Credential scan... "
|
|
102
|
-
CRED_HITS=$(grep -rEin '["'"'"'](?:password|passwd|secret|api_key|apikey|token|auth_token|access_token|private_key)["'"'"']\s*:\s*["'"'"'][^"'"'"']{4,}["'"'"']' "$NPM_ROOT/gateway/" --include="*.py" --include="*.js" --include="*.json" 2>/dev/null | grep -v 'environ\|getenv\|process\.env\|os\.environ\|example\|placeholder\|REDACTED\|your_\|change.me\|TODO\|FIXME\|xxx\|None\|null\|undefined\|test_password\|test_secret' || true)
|
|
103
|
-
if [ -n "$CRED_HITS" ]; then
|
|
104
|
-
echo "FAILED"
|
|
105
|
-
echo " Hardcoded credentials detected in gateway bundle:"
|
|
106
|
-
echo "$CRED_HITS" | while read -r line; do echo " $line"; done
|
|
107
|
-
echo " Fix: replace hardcoded values with env var lookups"
|
|
108
|
-
exit 1
|
|
109
|
-
fi
|
|
110
|
-
echo "clean"
|
|
111
|
-
|
|
112
|
-
echo "Gateway sync complete"
|