@untools/devflow 0.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/.versionrc.json +53 -0
- package/README.md +345 -0
- package/bin/devflow-agent.js +8 -0
- package/fix-imports.js +40 -0
- package/package.json +68 -0
package/.versionrc.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"types": [
|
|
3
|
+
{
|
|
4
|
+
"type": "feat",
|
|
5
|
+
"section": "Features",
|
|
6
|
+
"hidden": false
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"type": "fix",
|
|
10
|
+
"section": "Bug Fixes",
|
|
11
|
+
"hidden": false
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"type": "perf",
|
|
15
|
+
"section": "Performance",
|
|
16
|
+
"hidden": false
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"type": "docs",
|
|
20
|
+
"section": "Documentation",
|
|
21
|
+
"hidden": false
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "style",
|
|
25
|
+
"section": "Styling",
|
|
26
|
+
"hidden": true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"type": "refactor",
|
|
30
|
+
"section": "Code Refactoring",
|
|
31
|
+
"hidden": false
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "test",
|
|
35
|
+
"section": "Tests",
|
|
36
|
+
"hidden": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "chore",
|
|
40
|
+
"section": "Chores",
|
|
41
|
+
"hidden": true
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"commitUrlFormat": "https://github.com/miracleonyenma/devflow/commit/{{hash}}",
|
|
45
|
+
"compareUrlFormat": "https://github.com/miracleonyenma/devflow/compare/{{previousTag}}...{{currentTag}}",
|
|
46
|
+
"issueUrlFormat": "https://github.com/miracleonyenma/devflow/issues/{{id}}",
|
|
47
|
+
"userUrlFormat": "https://github.com/{{user}}",
|
|
48
|
+
"releaseCommitMessageFormat": "chore(release): {{currentTag}}",
|
|
49
|
+
"issuePrefixes": ["#"],
|
|
50
|
+
"skipBump": false,
|
|
51
|
+
"skipCommit": false,
|
|
52
|
+
"skipTag": false
|
|
53
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# @untools/devflow
|
|
2
|
+
|
|
3
|
+
The self-hosted CLI agent for **DevFlow** - an AI-powered DevOps platform powered by GitHub Copilot.
|
|
4
|
+
|
|
5
|
+
Install this CLI tool on your local machine or server to execute AI-driven development tasks securely on your own infrastructure.
|
|
6
|
+
|
|
7
|
+
## What is DevFlow?
|
|
8
|
+
|
|
9
|
+
DevFlow is a production SaaS platform that orchestrates AI-powered development workflows. Create a DevFlow account, connect your GitHub repositories and communication channels (Slack, Telegram), then use the **@untools/devflow** CLI to execute complex development tasks right from your machine.
|
|
10
|
+
|
|
11
|
+
**Key Features:**
|
|
12
|
+
- 🤖 AI-powered development workflows (fix bugs, implement features, write documentation, review PRs)
|
|
13
|
+
- 🔒 Self-hosted - code never leaves your machine
|
|
14
|
+
- 📱 Multi-channel notifications (Slack, Telegram)
|
|
15
|
+
- 🔗 GitHub integration for repositories, issues, and pull requests
|
|
16
|
+
- ⚡ Real-time task execution with progress updates
|
|
17
|
+
- 🛠️ Built on GitHub Copilot SDK
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Install @untools/devflow globally via npm:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g @untools/devflow
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or locally in your project:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @untools/devflow
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
### 1. Authenticate
|
|
36
|
+
|
|
37
|
+
Initialize your local agent and connect to the DevFlow platform:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
devflow init
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This command will:
|
|
44
|
+
- Prompt you for your DevFlow account credentials
|
|
45
|
+
- Open a browser for OAuth authentication if needed
|
|
46
|
+
- Save a secure JWT token to `~/.devflow/config.json`
|
|
47
|
+
- Create your local agent registration
|
|
48
|
+
|
|
49
|
+
### 2. Start the Agent
|
|
50
|
+
|
|
51
|
+
Run the CLI agent to begin polling for tasks:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
devflow start
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The agent will:
|
|
58
|
+
- Connect to the DevFlow platform
|
|
59
|
+
- Poll for pending tasks every 5 seconds
|
|
60
|
+
- Execute workflows using GitHub Copilot
|
|
61
|
+
- Report progress and results back to the platform
|
|
62
|
+
- Send notifications to your Slack/Telegram channels
|
|
63
|
+
|
|
64
|
+
### 3. Execute Tasks
|
|
65
|
+
|
|
66
|
+
Tasks are created through the DevFlow web dashboard or API. Once you start the agent, it will automatically:
|
|
67
|
+
1. Receive task assignments
|
|
68
|
+
2. Execute workflows (fix-bug, feature, explain, review-pr)
|
|
69
|
+
3. Update task progress in real-time
|
|
70
|
+
4. Notify you when complete
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
The agent stores configuration in `~/.devflow/config.json`:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"version": "1.0",
|
|
79
|
+
"platform": {
|
|
80
|
+
"url": "https://devflow.dev",
|
|
81
|
+
"api_key": "your-jwt-token"
|
|
82
|
+
},
|
|
83
|
+
"agent": {
|
|
84
|
+
"id": "agent-12345",
|
|
85
|
+
"name": "my-local-agent",
|
|
86
|
+
"version": "0.1.0"
|
|
87
|
+
},
|
|
88
|
+
"logging": {
|
|
89
|
+
"level": "info",
|
|
90
|
+
"format": "text"
|
|
91
|
+
},
|
|
92
|
+
"execution": {
|
|
93
|
+
"max_concurrent_tasks": 1,
|
|
94
|
+
"timeout_seconds": 3600,
|
|
95
|
+
"cache_dir": "~/.devflow/cache"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Security Note:** This file is created with `0o600` permissions (user-readable only). Never share your config file or API key.
|
|
101
|
+
|
|
102
|
+
## Environment Variables
|
|
103
|
+
|
|
104
|
+
Configure the agent with these environment variables:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Platform connection
|
|
108
|
+
DEVFLOW_PLATFORM_URL=https://devflow.dev
|
|
109
|
+
DEVFLOW_AGENT_TOKEN=your-jwt-token
|
|
110
|
+
DEVFLOW_AGENT_ID=agent-12345
|
|
111
|
+
|
|
112
|
+
# Agent-Host communication (for task execution)
|
|
113
|
+
AGENT_HOST_URL=http://localhost:3001
|
|
114
|
+
|
|
115
|
+
# Copilot SDK
|
|
116
|
+
COPILOT_MODEL=gpt-4.1
|
|
117
|
+
|
|
118
|
+
# Logging
|
|
119
|
+
DEVFLOW_LOG_LEVEL=info
|
|
120
|
+
DEVFLOW_LOG_FORMAT=text
|
|
121
|
+
|
|
122
|
+
# Polling
|
|
123
|
+
DEVFLOW_POLL_INTERVAL=5000
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Commands
|
|
127
|
+
|
|
128
|
+
### `devflow init`
|
|
129
|
+
|
|
130
|
+
Initialize and authenticate with the DevFlow platform.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
devflow init
|
|
134
|
+
# ? Platform URL: https://devflow.dev
|
|
135
|
+
# ? Authenticate with DevFlow? (Y/n)
|
|
136
|
+
# ✓ Configuration saved to ~/.devflow/config.json
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### `devflow start`
|
|
140
|
+
|
|
141
|
+
Start the agent and begin polling for tasks.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
devflow start
|
|
145
|
+
# 🚀 DevFlow Agent started
|
|
146
|
+
# 📍 Platform: https://devflow.dev
|
|
147
|
+
# 🔄 Polling interval: 5000ms
|
|
148
|
+
# ⏳ Waiting for tasks...
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The agent will display:
|
|
152
|
+
- Incoming task assignments
|
|
153
|
+
- Execution progress
|
|
154
|
+
- Completion status
|
|
155
|
+
- Any errors encountered
|
|
156
|
+
|
|
157
|
+
### `devflow status`
|
|
158
|
+
|
|
159
|
+
Check the current status and configuration of your agent.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
devflow status
|
|
163
|
+
# 🏃 Agent Status
|
|
164
|
+
# ├─ Connected: true
|
|
165
|
+
# ├─ Agent ID: agent-12345
|
|
166
|
+
# ├─ Platform: https://devflow.dev
|
|
167
|
+
# ├─ Uptime: 2 hours 34 minutes
|
|
168
|
+
# └─ Tasks processed: 5
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### `devflow help`
|
|
172
|
+
|
|
173
|
+
Display help for all available commands.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
devflow help
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Supported Workflows
|
|
180
|
+
|
|
181
|
+
The agent can execute these AI-powered workflows:
|
|
182
|
+
|
|
183
|
+
| Workflow | Description | Input |
|
|
184
|
+
|----------|-------------|-------|
|
|
185
|
+
| `fix-bug` | Analyze issue, fix code, run tests, create PR | Issue description, repo URL |
|
|
186
|
+
| `feature` | Implement new feature with tests and documentation | Feature requirements, repo URL |
|
|
187
|
+
| `explain` | Generate documentation for code | Code snippet, documentation type |
|
|
188
|
+
| `review-pr` | Review pull request for best practices | PR URL, focus areas |
|
|
189
|
+
|
|
190
|
+
## Task Execution Flow
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
DevFlow Platform
|
|
194
|
+
↓
|
|
195
|
+
Enqueues Task
|
|
196
|
+
↓
|
|
197
|
+
CLI Agent Polls /api/agents/[id]/commands
|
|
198
|
+
↓
|
|
199
|
+
Receives Task
|
|
200
|
+
↓
|
|
201
|
+
Calls Agent-Host API (/api/workflows/execute)
|
|
202
|
+
↓
|
|
203
|
+
Agent-Host invokes Copilot SDK
|
|
204
|
+
↓
|
|
205
|
+
Copilot executes tools and workflows
|
|
206
|
+
↓
|
|
207
|
+
Agent reports progress & completion
|
|
208
|
+
↓
|
|
209
|
+
Platform notifies user (Slack/Telegram)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Security & Privacy
|
|
213
|
+
|
|
214
|
+
- **Local Execution:** Code analysis and modification happens on your machine only
|
|
215
|
+
- **Secure Config:** Configuration stored with `0o600` permissions (user-readable only)
|
|
216
|
+
- **Token Storage:** JWT tokens never leave your `~/.devflow/config.json` file
|
|
217
|
+
- **No Code Upload:** Your repository code is never sent to external services
|
|
218
|
+
- **GitHub Credentials:** Optional PAT stored locally, never shared with platform
|
|
219
|
+
|
|
220
|
+
## Troubleshooting
|
|
221
|
+
|
|
222
|
+
### Agent won't start
|
|
223
|
+
|
|
224
|
+
Check that you've initialized the agent first:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
devflow status # If this fails, run init first
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Tasks not received
|
|
231
|
+
|
|
232
|
+
Verify your platform connection:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
devflow status
|
|
236
|
+
# Look for "Connected: true"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Check your JWT token hasn't expired (30-day expiry):
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
cat ~/.devflow/config.json | grep api_key
|
|
243
|
+
# Token should be valid
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Execution failures
|
|
247
|
+
|
|
248
|
+
Enable debug logging:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
DEVFLOW_LOG_LEVEL=debug devflow start
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Check agent-host is running (if using custom workflows):
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
curl http://localhost:3001/health
|
|
258
|
+
# Should return {"status": "healthy"}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Authentication issues
|
|
262
|
+
|
|
263
|
+
Re-initialize your authentication:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
rm ~/.devflow/config.json
|
|
267
|
+
devflow init
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Development
|
|
271
|
+
|
|
272
|
+
For developers contributing to devflow:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Clone the repository
|
|
276
|
+
git clone https://github.com/devflow/devflow.git
|
|
277
|
+
cd devflow
|
|
278
|
+
|
|
279
|
+
# Install dependencies
|
|
280
|
+
npm install
|
|
281
|
+
|
|
282
|
+
# Build TypeScript
|
|
283
|
+
npm run build
|
|
284
|
+
|
|
285
|
+
# Run in development mode
|
|
286
|
+
npm run dev
|
|
287
|
+
|
|
288
|
+
# Run CLI tests
|
|
289
|
+
npm run cli -- init
|
|
290
|
+
npm run cli -- start
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Architecture
|
|
294
|
+
|
|
295
|
+
The DevFlow system consists of three components:
|
|
296
|
+
|
|
297
|
+
1. **Pinga Web Platform** - SaaS dashboard for task creation, monitoring, and configuration
|
|
298
|
+
2. **Agent CLI** (this package) - Self-hosted CLI that polls for and executes tasks
|
|
299
|
+
3. **Agent-Host** - Local service that runs Copilot SDK workflows
|
|
300
|
+
|
|
301
|
+
Communication flow:
|
|
302
|
+
```
|
|
303
|
+
Web Platform → Agent CLI (polls) → Agent-Host (executes)
|
|
304
|
+
↓
|
|
305
|
+
Copilot SDK / Tools
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Contributing
|
|
309
|
+
|
|
310
|
+
We welcome contributions! Please:
|
|
311
|
+
|
|
312
|
+
1. Fork the repository
|
|
313
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
314
|
+
3. Commit changes (`git commit -m 'Add amazing feature'`)
|
|
315
|
+
4. Push to branch (`git push origin feature/amazing-feature`)
|
|
316
|
+
5. Open a Pull Request
|
|
317
|
+
|
|
318
|
+
## License
|
|
319
|
+
|
|
320
|
+
MIT License - see LICENSE file for details
|
|
321
|
+
|
|
322
|
+
## Support
|
|
323
|
+
|
|
324
|
+
- 📖 [DevFlow Documentation](https://docs.devflow.dev)
|
|
325
|
+
- 💬 [GitHub Discussions](https://github.com/devflow/devflow/discussions)
|
|
326
|
+
- 🐛 [Report Issues](https://github.com/devflow/devflow/issues)
|
|
327
|
+
- 📧 [Email Support](support@devflow.dev)
|
|
328
|
+
|
|
329
|
+
## Changelog
|
|
330
|
+
|
|
331
|
+
### v0.1.0 (Beta)
|
|
332
|
+
|
|
333
|
+
- Initial release with core CLI commands (init, start, status)
|
|
334
|
+
- GitHub Copilot SDK integration
|
|
335
|
+
- Workflow execution (fix-bug, feature, explain, review-pr)
|
|
336
|
+
- Platform API integration
|
|
337
|
+
- Secure token-based authentication
|
|
338
|
+
- Configuration management
|
|
339
|
+
- Task polling and execution
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
**Made with ❤️ for developers by the DevFlow team**
|
|
344
|
+
|
|
345
|
+
Built on the GitHub Copilot SDK for the [GitHub Copilot CLI Challenge](https://github.blog/news-and-insights/copilot-cli-challenge/)
|
package/fix-imports.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
const distDir = path.join(__dirname, 'dist');
|
|
9
|
+
|
|
10
|
+
function fixImports(dir) {
|
|
11
|
+
const files = fs.readdirSync(dir);
|
|
12
|
+
|
|
13
|
+
files.forEach(file => {
|
|
14
|
+
const filePath = path.join(dir, file);
|
|
15
|
+
const stat = fs.statSync(filePath);
|
|
16
|
+
|
|
17
|
+
if (stat.isDirectory()) {
|
|
18
|
+
fixImports(filePath);
|
|
19
|
+
} else if (file.endsWith('.js')) {
|
|
20
|
+
let content = fs.readFileSync(filePath, 'utf8');
|
|
21
|
+
|
|
22
|
+
// Add .js to relative imports (./xxx or ../xxx) that don't already have it
|
|
23
|
+
content = content.replace(
|
|
24
|
+
/from\s+['"](\.[^'"]*?)(?<!\.js)['"]/g,
|
|
25
|
+
(match, importPath) => `from '${importPath}.js'`
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
fixImports(distDir);
|
|
35
|
+
console.log('✓ Import paths fixed');
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.error('✗ Error fixing imports:', err);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@untools/devflow",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Self-hosted AI DevOps agent for DevFlow platform",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"devflow": "./bin/devflow-agent.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/miracleonyenma/devflow.git"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/miracleonyenma/devflow/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/miracleonyenma/devflow#readme",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc && node fix-imports.js",
|
|
23
|
+
"dev": "tsx src/index.ts",
|
|
24
|
+
"start": "node dist/index.js",
|
|
25
|
+
"cli": "tsx src/cli.ts",
|
|
26
|
+
"clean": "rm -rf dist",
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"release": "standard-version",
|
|
29
|
+
"release:patch": "standard-version --release-as patch",
|
|
30
|
+
"release:minor": "standard-version --release-as minor",
|
|
31
|
+
"release:major": "standard-version --release-as major"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"devflow",
|
|
35
|
+
"copilot",
|
|
36
|
+
"ai",
|
|
37
|
+
"devops",
|
|
38
|
+
"automation",
|
|
39
|
+
"github",
|
|
40
|
+
"slack",
|
|
41
|
+
"telegram",
|
|
42
|
+
"github-copilot",
|
|
43
|
+
"cli-agent"
|
|
44
|
+
],
|
|
45
|
+
"author": "Miracle Onyenma",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@github/copilot-sdk": "^0.1.16",
|
|
52
|
+
"axios": "^1.6.0",
|
|
53
|
+
"dotenv": "^16.3.1",
|
|
54
|
+
"open": "^9.1.0",
|
|
55
|
+
"simple-git": "^3.22.0",
|
|
56
|
+
"yargs": "^17.7.2"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/node": "^20.10.0",
|
|
60
|
+
"@types/yargs": "^17.0.35",
|
|
61
|
+
"standard-version": "^9.5.0",
|
|
62
|
+
"tsx": "^4.7.0",
|
|
63
|
+
"typescript": "^5.3.3"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=18.0.0"
|
|
67
|
+
}
|
|
68
|
+
}
|