@utopia-ai/cli 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.
Files changed (49) hide show
  1. package/.claude/settings.json +1 -0
  2. package/.claude/settings.local.json +38 -0
  3. package/bin/utopia.js +20 -0
  4. package/package.json +46 -0
  5. package/python/README.md +34 -0
  6. package/python/instrumenter/instrument.py +1148 -0
  7. package/python/pyproject.toml +32 -0
  8. package/python/setup.py +27 -0
  9. package/python/utopia_runtime/__init__.py +30 -0
  10. package/python/utopia_runtime/__pycache__/__init__.cpython-313.pyc +0 -0
  11. package/python/utopia_runtime/__pycache__/client.cpython-313.pyc +0 -0
  12. package/python/utopia_runtime/__pycache__/probe.cpython-313.pyc +0 -0
  13. package/python/utopia_runtime/client.py +31 -0
  14. package/python/utopia_runtime/probe.py +446 -0
  15. package/python/utopia_runtime.egg-info/PKG-INFO +59 -0
  16. package/python/utopia_runtime.egg-info/SOURCES.txt +10 -0
  17. package/python/utopia_runtime.egg-info/dependency_links.txt +1 -0
  18. package/python/utopia_runtime.egg-info/top_level.txt +1 -0
  19. package/scripts/publish-npm.sh +14 -0
  20. package/scripts/publish-pypi.sh +17 -0
  21. package/src/cli/commands/codex.ts +193 -0
  22. package/src/cli/commands/context.ts +188 -0
  23. package/src/cli/commands/destruct.ts +237 -0
  24. package/src/cli/commands/easter-eggs.ts +203 -0
  25. package/src/cli/commands/init.ts +505 -0
  26. package/src/cli/commands/instrument.ts +962 -0
  27. package/src/cli/commands/mcp.ts +16 -0
  28. package/src/cli/commands/serve.ts +194 -0
  29. package/src/cli/commands/status.ts +304 -0
  30. package/src/cli/commands/validate.ts +328 -0
  31. package/src/cli/index.ts +37 -0
  32. package/src/cli/utils/config.ts +54 -0
  33. package/src/graph/index.ts +687 -0
  34. package/src/instrumenter/javascript.ts +1798 -0
  35. package/src/mcp/index.ts +886 -0
  36. package/src/runtime/js/index.ts +518 -0
  37. package/src/runtime/js/package-lock.json +30 -0
  38. package/src/runtime/js/package.json +30 -0
  39. package/src/runtime/js/tsconfig.json +16 -0
  40. package/src/server/db/index.ts +26 -0
  41. package/src/server/db/schema.ts +45 -0
  42. package/src/server/index.ts +79 -0
  43. package/src/server/middleware/auth.ts +74 -0
  44. package/src/server/routes/admin.ts +36 -0
  45. package/src/server/routes/graph.ts +358 -0
  46. package/src/server/routes/probes.ts +286 -0
  47. package/src/types.ts +147 -0
  48. package/src/utopia-mode/index.ts +206 -0
  49. package/tsconfig.json +19 -0
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,38 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm install:*)",
5
+ "Bash(npx tsc:*)",
6
+ "Bash(curl:*)",
7
+ "Bash(pkill -f \"tsx src/server\")",
8
+ "Bash(npx tsx:*)",
9
+ "Bash(npm link:*)",
10
+ "Bash(utopia --version)",
11
+ "Bash(chmod +x /Users/paulvann/Desktop/cool-projects/utopia/bin/utopia.js)",
12
+ "Bash(npm unlink:*)",
13
+ "Bash(pnpm link:*)",
14
+ "Bash(ls /Users/paulvann/Desktop/cool-projects/validia-landing/node_modules/.pnpm/utopia-runtime*)",
15
+ "Bash(ls:*)",
16
+ "Bash(grep -r \"NEXT_PUBLIC\" /Users/paulvann/Desktop/cool-projects/validia-landing/.env*)",
17
+ "Bash(utopia --help)",
18
+ "Bash(utopia serve:*)",
19
+ "Bash(rm -rf /Users/paulvann/Desktop/cool-projects/validia-landing/node_modules/utopia-runtime)",
20
+ "Bash(pnpm install:*)",
21
+ "Bash(pnpm unlink:*)",
22
+ "Bash(rm -rf node_modules/utopia-runtime node_modules/.pnpm/utopia-runtime*)",
23
+ "Bash(rm -f node_modules/utopia-runtime)",
24
+ "Bash(rm -f pnpm-lock.yaml)",
25
+ "Bash(node:*)",
26
+ "Bash(/Users/paulvann/Desktop/cool-projects/validia-landing/.env.local:*)",
27
+ "Bash(utopia reinstrument:*)",
28
+ "WebSearch",
29
+ "Bash(chmod:*)",
30
+ "Bash(python3 -c \"import sys,json; d=json.load\\(sys.stdin\\); print\\(d.get\\(''''description'''',''''''''\\), d.get\\(''''default_branch'''',''''''''\\), d.get\\(''''html_url'''',''''''''\\)\\)\")",
31
+ "Bash(python3 -c \":*)",
32
+ "Bash(python3 -c ':*)",
33
+ "Bash(npm view:*)",
34
+ "Bash(npm org:*)",
35
+ "Bash(npm publish:*)"
36
+ ]
37
+ }
38
+ }
package/bin/utopia.js ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import { register } from 'node:module';
3
+ import { pathToFileURL } from 'node:url';
4
+ import { dirname, resolve } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { execFileSync } from 'node:child_process';
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const entry = resolve(__dirname, '..', 'src', 'cli', 'index.ts');
10
+
11
+ // Use tsx to run the TypeScript entry point directly
12
+ try {
13
+ execFileSync(
14
+ resolve(__dirname, '..', 'node_modules', '.bin', 'tsx'),
15
+ [entry, ...process.argv.slice(2)],
16
+ { stdio: 'inherit', cwd: process.cwd() }
17
+ );
18
+ } catch (err) {
19
+ process.exit(err.status || 1);
20
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@utopia-ai/cli",
3
+ "version": "0.1.0",
4
+ "description": "Production-aware probes that give AI coding agents real-time context about how code runs in production",
5
+ "type": "module",
6
+ "bin": {
7
+ "utopia": "./bin/utopia.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "tsx src/cli/index.ts",
12
+ "start:server": "tsx src/server/index.ts",
13
+ "start:mcp": "tsx src/mcp/index.ts"
14
+ },
15
+ "keywords": ["cli", "probes", "observability", "ai", "claude", "codex", "production-context"],
16
+ "license": "MIT",
17
+ "dependencies": {
18
+ "@anthropic-ai/sdk": "^0.39.0",
19
+ "@babel/core": "^7.26.0",
20
+ "@babel/generator": "^7.26.0",
21
+ "@babel/parser": "^7.26.0",
22
+ "@babel/traverse": "^7.26.0",
23
+ "@babel/types": "^7.26.0",
24
+ "@modelcontextprotocol/sdk": "^1.7.0",
25
+ "better-sqlite3": "^11.7.0",
26
+ "chalk": "^5.4.0",
27
+ "commander": "^13.0.0",
28
+ "express": "^4.21.0",
29
+ "inquirer": "^12.3.0",
30
+ "uuid": "^11.0.0"
31
+ },
32
+ "devDependencies": {
33
+ "@types/babel__core": "^7.20.5",
34
+ "@types/babel__generator": "^7.6.8",
35
+ "@types/babel__traverse": "^7.20.6",
36
+ "@types/better-sqlite3": "^7.6.12",
37
+ "@types/express": "^5.0.0",
38
+ "@types/node": "^22.10.0",
39
+ "@types/uuid": "^10.0.0",
40
+ "tsx": "^4.19.0",
41
+ "typescript": "^5.7.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=18.0.0"
45
+ }
46
+ }
@@ -0,0 +1,34 @@
1
+ # utopia-runtime
2
+
3
+ Zero-impact production probe runtime for [Utopia](https://github.com/paulvann/utopia).
4
+
5
+ Captures errors, API calls, database queries, function behavior, and infrastructure context — sending it to the Utopia data service so AI coding agents can understand how your code runs in production.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install utopia-runtime
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Probes are added by `utopia instrument` — you don't typically import this directly. The runtime auto-initializes from `.utopia/config.json` in your project root.
16
+
17
+ ```python
18
+ import utopia_runtime
19
+
20
+ # Reports are non-blocking and never raise
21
+ utopia_runtime.report_function(
22
+ file="app/routes.py",
23
+ line=25,
24
+ function_name="get_user",
25
+ args=[{"user_id": 123}],
26
+ return_value={"found": True},
27
+ duration=15,
28
+ call_stack=[],
29
+ )
30
+ ```
31
+
32
+ ## Zero dependencies
33
+
34
+ Uses only the Python standard library. No external packages required.