delimit-cli 3.15.7 → 3.15.9

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.
@@ -3684,6 +3684,19 @@ def delimit_swarm(action: str = "status", venture: str = "",
3684
3684
  return _with_next_steps("swarm", _safe_call(
3685
3685
  check_namespace_access, agent_id=agent_id, target_path=target_path, action=access_action,
3686
3686
  ))
3687
+ if action == "metric":
3688
+ from ai.swarm import record_metric
3689
+ return _with_next_steps("swarm", _safe_call(
3690
+ record_metric, venture=venture, metric_type=access_action, note=target_path,
3691
+ ))
3692
+ if action == "metrics":
3693
+ from ai.swarm import get_metrics
3694
+ return _with_next_steps("swarm", _safe_call(get_metrics, venture=venture))
3695
+ if action == "docs_check":
3696
+ from ai.swarm import check_docs_freshness
3697
+ return _with_next_steps("swarm", _safe_call(
3698
+ check_docs_freshness, project_path=repo_path or ".",
3699
+ ))
3687
3700
  return _with_next_steps("swarm", _safe_call(get_swarm_status))
3688
3701
 
3689
3702
 
@@ -395,3 +395,198 @@ Medium alerts: prompt drift, model errors, credit exhaustion.
395
395
  def get_usage_guide() -> Dict[str, Any]:
396
396
  """Get the swarm usage guide."""
397
397
  return {"guide": USAGE_GUIDE, "version": "1.2"}
398
+
399
+
400
+ # ═══════════════════════════════════════════════════════════════════════
401
+ # LED-278: GTM Tracking — speed, revenue, venture launches
402
+ # ═══════════════════════════════════════════════════════════════════════
403
+
404
+ METRICS_FILE = SWARM_DIR / "metrics.json"
405
+
406
+
407
+ def _load_metrics() -> Dict[str, Any]:
408
+ if not METRICS_FILE.exists():
409
+ return {"daily": {}, "ventures": {}}
410
+ try:
411
+ return json.loads(METRICS_FILE.read_text())
412
+ except (json.JSONDecodeError, OSError):
413
+ return {"daily": {}, "ventures": {}}
414
+
415
+
416
+ def _save_metrics(metrics: Dict[str, Any]):
417
+ _ensure_dir()
418
+ METRICS_FILE.write_text(json.dumps(metrics, indent=2))
419
+
420
+
421
+ def record_metric(
422
+ venture: str,
423
+ metric_type: str,
424
+ value: float = 1.0,
425
+ note: str = "",
426
+ ) -> Dict[str, Any]:
427
+ """Record a GTM metric for tracking swarm performance.
428
+
429
+ Metric types: tasks_completed, deploy_count, revenue, launch_event,
430
+ outreach_sent, user_signup, feature_shipped.
431
+ """
432
+ if not venture or not metric_type:
433
+ return {"error": "venture and metric_type required"}
434
+
435
+ metrics = _load_metrics()
436
+ today = time.strftime("%Y-%m-%d")
437
+
438
+ # Daily tracking
439
+ if today not in metrics["daily"]:
440
+ metrics["daily"][today] = {}
441
+ day = metrics["daily"][today]
442
+ key = f"{venture}:{metric_type}"
443
+ day[key] = day.get(key, 0) + value
444
+
445
+ # Venture totals
446
+ if venture not in metrics["ventures"]:
447
+ metrics["ventures"][venture] = {}
448
+ vtotals = metrics["ventures"][venture]
449
+ vtotals[metric_type] = vtotals.get(metric_type, 0) + value
450
+
451
+ _save_metrics(metrics)
452
+ _log({"action": "metric", "venture": venture, "type": metric_type, "value": value, "note": note})
453
+
454
+ return {
455
+ "status": "recorded",
456
+ "venture": venture,
457
+ "metric": metric_type,
458
+ "value": value,
459
+ "today_total": day[key],
460
+ "all_time": vtotals[metric_type],
461
+ }
462
+
463
+
464
+ def get_metrics(venture: str = "", days: int = 7) -> Dict[str, Any]:
465
+ """Get GTM metrics — speed, revenue, launches across ventures.
466
+
467
+ Shows daily breakdown and venture totals. Used for dogfood tracking
468
+ and build-in-public content.
469
+ """
470
+ metrics = _load_metrics()
471
+
472
+ # Filter by date range
473
+ today = time.strftime("%Y-%m-%d")
474
+ recent_days = {}
475
+ for date_str, day_data in sorted(metrics["daily"].items(), reverse=True)[:days]:
476
+ if venture:
477
+ filtered = {k: v for k, v in day_data.items() if k.startswith(f"{venture}:")}
478
+ if filtered:
479
+ recent_days[date_str] = filtered
480
+ else:
481
+ recent_days[date_str] = day_data
482
+
483
+ # Venture totals
484
+ if venture:
485
+ vtotals = metrics["ventures"].get(venture, {})
486
+ else:
487
+ vtotals = metrics["ventures"]
488
+
489
+ return {
490
+ "status": "ok",
491
+ "daily": recent_days,
492
+ "totals": vtotals,
493
+ "venture_filter": venture or "all",
494
+ "days": days,
495
+ }
496
+
497
+
498
+ # ═══════════════════════════════════════════════════════════════════════
499
+ # Change Management — docs freshness check before deploy
500
+ # ═══════════════════════════════════════════════════════════════════════
501
+
502
+ DOCS_CHECKLIST = [
503
+ {"file": "README.md", "check": "tool_count", "pattern": r"\d+ (?:MCP |governance )?tools"},
504
+ {"file": "README.md", "check": "version_badge", "pattern": r"GitHub%20Action-v[\d.]+"},
505
+ {"file": "README.md", "check": "cli_commands", "pattern": r"npx delimit-cli"},
506
+ ]
507
+
508
+
509
+ def check_docs_freshness(
510
+ project_path: str = ".",
511
+ tool_count: int = 0,
512
+ version: str = "",
513
+ ) -> Dict[str, Any]:
514
+ """Check if documentation is up-to-date before deploying.
515
+
516
+ Verifies README, changelog, and landing page reflect current
517
+ tool count, version, and feature set.
518
+ """
519
+ import re
520
+ p = Path(project_path).resolve()
521
+ findings = []
522
+ stale = False
523
+
524
+ # Check README exists
525
+ readme = p / "README.md"
526
+ if not readme.exists():
527
+ findings.append({"file": "README.md", "status": "missing", "severity": "warning"})
528
+ else:
529
+ content = readme.read_text()
530
+
531
+ # Check tool count
532
+ if tool_count > 0:
533
+ counts = re.findall(r'(\d+)\s*(?:MCP |governance )?tools', content)
534
+ for count_str in counts:
535
+ count = int(count_str)
536
+ if abs(count - tool_count) > 10:
537
+ findings.append({
538
+ "file": "README.md",
539
+ "status": "stale",
540
+ "issue": f"Says {count} tools, actual is {tool_count}",
541
+ "severity": "warning",
542
+ })
543
+ stale = True
544
+
545
+ # Check version badge
546
+ if version:
547
+ if version not in content:
548
+ findings.append({
549
+ "file": "README.md",
550
+ "status": "stale",
551
+ "issue": f"Version badge doesn't show {version}",
552
+ "severity": "info",
553
+ })
554
+
555
+ # Check What's New / CHANGELOG
556
+ changelog = p / "CHANGELOG.md"
557
+ if changelog.exists():
558
+ cl_content = changelog.read_text()
559
+ if version and version not in cl_content:
560
+ findings.append({
561
+ "file": "CHANGELOG.md",
562
+ "status": "stale",
563
+ "issue": f"No entry for version {version}",
564
+ "severity": "warning",
565
+ })
566
+ stale = True
567
+
568
+ # Check for uncommitted changes
569
+ try:
570
+ import subprocess
571
+ result = subprocess.run(
572
+ ["git", "status", "--porcelain"], capture_output=True, text=True,
573
+ cwd=str(p), timeout=5,
574
+ )
575
+ uncommitted = len(result.stdout.strip().split("\n")) if result.stdout.strip() else 0
576
+ if uncommitted > 0:
577
+ findings.append({
578
+ "file": "working tree",
579
+ "status": "dirty",
580
+ "issue": f"{uncommitted} uncommitted file(s)",
581
+ "severity": "info",
582
+ })
583
+ except Exception:
584
+ pass
585
+
586
+ return {
587
+ "status": "stale" if stale else "fresh",
588
+ "findings": findings,
589
+ "total_issues": len(findings),
590
+ "stale": stale,
591
+ "message": f"{len(findings)} doc issue(s) found" if findings else "Documentation is up to date",
592
+ }
@@ -42,6 +42,13 @@ The founder reviews and approves via email. The AI's job is to draft, send, and
42
42
  - Deploy requested: \`delimit_security_audit\` then \`delimit_test_smoke\` then \`delimit_changelog\` then \`delimit_deploy_plan\`
43
43
  - Deploy succeeds: \`delimit_deploy_verify\` + \`delimit_evidence_collect\`
44
44
  - Verify succeeds: \`delimit_ledger_done\` (related task) + \`delimit_notify\`
45
+
46
+ ### Change Management (update docs with every ship)
47
+ - After shipping a feature: update README if CLI commands or tool count changed
48
+ - After version bump: update version badge, tool count, test count on landing page
49
+ - After npm publish: sync gateway server.py to npm bundle, scrub PII, run security-check.sh
50
+ - After changing pricing/tiers: update pricing page and Lemon Squeezy product
51
+ - Before deploy: call \`delimit_swarm(action="docs_check")\` to verify docs freshness
45
52
  - Before submitting a PR to an external repo: call \`delimit_deliberate\` on the diff + PR description (Pro only — if using free tier deliberations and quota is exhausted, skip this gate but log a warning)
46
53
 
47
54
  ### Content / Outreach (all drafts, never auto-post)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "delimit-cli",
3
3
  "mcpName": "io.github.delimit-ai/delimit-mcp-server",
4
- "version": "3.15.7",
4
+ "version": "3.15.9",
5
5
  "description": "Unify Claude Code, Codex, Cursor, and Gemini CLI with persistent context, governance, and multi-model debate.",
6
6
  "main": "index.js",
7
7
  "files": [