glenn-code 1.0.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/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # DNM Agent Local
2
+
3
+ Connect your local development environment to DNM Lab. Run AI-powered development sessions directly from your machine.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g glenn-code
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ # Navigate to your project directory
15
+ cd /path/to/your/project
16
+
17
+ # Start the agent
18
+ glenn-code
19
+ ```
20
+
21
+ On first run, you'll be prompted to configure your connection. You can either:
22
+ 1. **Paste config** - Copy the connection string from DNM Lab frontend
23
+ 2. **Enter manually** - Provide Master URL, Project ID, and Project Key
24
+ 3. **Interactive setup** - Configure your project stack interactively
25
+
26
+ Configuration is saved to `.sdd/local-signalr-config.json` for future sessions.
27
+
28
+ ## Usage
29
+
30
+ ```bash
31
+ # Start the agent (uses saved config or prompts for setup)
32
+ glenn-code
33
+
34
+ # Show help
35
+ glenn-code --help
36
+
37
+ # Show version
38
+ glenn-code --version
39
+ ```
40
+
41
+ ## Environment Variables
42
+
43
+ | Variable | Description | Default |
44
+ |----------|-------------|---------|
45
+ | `MASTER_URL` | DNM Lab backend URL | (prompted) |
46
+ | `PROJECT_ID` | Your project ID | (prompted) |
47
+ | `PROJECT_KEY` | Project API key (`pk_proj_...`) | (prompted) |
48
+ | `WORKSPACE_DIR` | Working directory | Current directory |
49
+
50
+ ## How It Works
51
+
52
+ 1. **Connect** - The agent establishes a SignalR connection to DNM Lab
53
+ 2. **Authenticate** - Uses your project key for secure authentication
54
+ 3. **Work** - Receives tasks from the DNM Lab frontend and executes them locally
55
+ 4. **Preview** - Your local dev server URL is reported back for live previews
56
+
57
+ ## Configuration File
58
+
59
+ The agent stores configuration in `.sdd/local-signalr-config.json`:
60
+
61
+ ```json
62
+ {
63
+ "masterUrl": "https://your-dnm-lab-instance.com",
64
+ "projectId": "your-project-id",
65
+ "projectKey": "pk_proj_...",
66
+ "containerId": "local-your-machine-abc123",
67
+ "enableTunnel": true,
68
+ "tunnelPort": 5173
69
+ }
70
+ ```
71
+
72
+ You can also embed project-specific configuration:
73
+
74
+ ```json
75
+ {
76
+ "masterUrl": "...",
77
+ "projectId": "...",
78
+ "projectKey": "...",
79
+ "containerId": "...",
80
+ "enableTunnel": true,
81
+ "tunnelPort": 3000,
82
+ "version": "1.0",
83
+ "paths": {
84
+ "workspace": ".",
85
+ "frontend": "./frontend",
86
+ "backend": "./backend"
87
+ },
88
+ "services": {
89
+ "frontend": {
90
+ "port": 3000,
91
+ "startCommand": "npm run dev",
92
+ "extensions": [".ts", ".tsx", ".js", ".jsx"]
93
+ },
94
+ "backend": {
95
+ "port": 8080,
96
+ "startCommand": "npm start",
97
+ "extensions": [".ts", ".js"]
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ ## Requirements
104
+
105
+ - Node.js 18+
106
+ - A DNM Lab account with a project set up
107
+ - Project API key from DNM Lab
108
+
109
+ ## Troubleshooting
110
+
111
+ **Connection failed**
112
+ - Check that your `MASTER_URL` is correct
113
+ - Verify your project key is valid
114
+ - Ensure you have network access to the DNM Lab server
115
+
116
+ **Agent not appearing in frontend**
117
+ - The agent must be running and connected
118
+ - Check the terminal for connection status
119
+ - Try restarting the agent
120
+
121
+ **Preview not working**
122
+ - Make sure your local dev server is running on the configured port
123
+ - Check that `tunnelPort` matches your dev server port
124
+
125
+ ## License
126
+
127
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Glenn Code
5
+ *
6
+ * Connect your local development environment to DNM Lab.
7
+ *
8
+ * Usage:
9
+ * glenn-code # Start the agent (interactive setup on first run)
10
+ * glenn-code --help # Show help
11
+ * glenn-code --version # Show version
12
+ */
13
+
14
+ import { fileURLToPath } from "url";
15
+ import * as path from "path";
16
+ import * as fs from "fs";
17
+
18
+ const __filename = fileURLToPath(import.meta.url);
19
+ const __dirname = path.dirname(__filename);
20
+ const packageDir = path.resolve(__dirname, "..");
21
+
22
+ // Handle --help
23
+ if (process.argv.includes("--help") || process.argv.includes("-h")) {
24
+ console.log(`
25
+ Glenn Code - Connect your local dev environment to DNM Lab
26
+
27
+ Usage:
28
+ glenn-code [options]
29
+
30
+ Options:
31
+ --help, -h Show this help message
32
+ --version, -v Show version number
33
+
34
+ Environment Variables:
35
+ MASTER_URL Backend URL (prompted if not set)
36
+ PROJECT_ID Project ID (prompted if not set)
37
+ PROJECT_KEY Project API key (prompted if not set)
38
+ WORKSPACE_DIR Working directory (defaults to current directory)
39
+
40
+ First Run:
41
+ On first run, you'll be prompted to configure your connection.
42
+ Settings are saved to .sdd/local-signalr-config.json in your project.
43
+
44
+ Tip: Copy the connection config from the DNM Lab frontend for quick setup!
45
+ `);
46
+ process.exit(0);
47
+ }
48
+
49
+ // Handle --version
50
+ if (process.argv.includes("--version") || process.argv.includes("-v")) {
51
+ try {
52
+ const pkg = JSON.parse(fs.readFileSync(path.join(packageDir, "package.json"), "utf-8"));
53
+ console.log(`glenn-code v${pkg.version}`);
54
+ } catch {
55
+ console.log("glenn-code v1.0.0");
56
+ }
57
+ process.exit(0);
58
+ }
59
+
60
+ // Set environment for local mode
61
+ process.env.LOCAL_MODE = "true";
62
+ process.env.WORKSPACE_DIR = process.env.WORKSPACE_DIR || process.cwd();
63
+
64
+ // Run the agent
65
+ async function main() {
66
+ try {
67
+ const { startSignalRAgent } = await import("../dist/cli.js");
68
+ await startSignalRAgent();
69
+ } catch (err) {
70
+ console.error("Failed to start agent:", err.message || err);
71
+ process.exit(1);
72
+ }
73
+ }
74
+
75
+ main();