@fractary/faber-cli 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/LICENSE +21 -0
- package/README.md +223 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +163 -0
- package/dist/commands/logs/index.d.ts +11 -0
- package/dist/commands/logs/index.d.ts.map +1 -0
- package/dist/commands/logs/index.js +330 -0
- package/dist/commands/repo/index.d.ts +11 -0
- package/dist/commands/repo/index.d.ts.map +1 -0
- package/dist/commands/repo/index.js +612 -0
- package/dist/commands/spec/index.d.ts +11 -0
- package/dist/commands/spec/index.d.ts.map +1 -0
- package/dist/commands/spec/index.js +280 -0
- package/dist/commands/work/index.d.ts +11 -0
- package/dist/commands/work/index.d.ts.map +1 -0
- package/dist/commands/work/index.js +748 -0
- package/dist/commands/workflow/index.d.ts +31 -0
- package/dist/commands/workflow/index.d.ts.map +1 -0
- package/dist/commands/workflow/index.js +298 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/utils/errors.d.ts +14 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +44 -0
- package/dist/utils/output.d.ts +18 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +39 -0
- package/dist/utils/validation.d.ts +30 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +49 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Fractary Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# @fractary/faber-cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for FABER development toolkit. Execute and manage FABER workflows, work items, repository operations, specifications, and logs.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @fractary/faber-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly with `npx`:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @fractary/faber-cli --help
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
### Initialize a FABER project
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
fractary-faber init
|
|
23
|
+
fractary-faber init --preset minimal
|
|
24
|
+
fractary-faber init --preset enterprise
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Workflow Commands
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Start a FABER workflow
|
|
31
|
+
fractary-faber run --work-id 123
|
|
32
|
+
|
|
33
|
+
# Check workflow status
|
|
34
|
+
fractary-faber status
|
|
35
|
+
fractary-faber status --workflow-id <id>
|
|
36
|
+
|
|
37
|
+
# Pause/resume workflows
|
|
38
|
+
fractary-faber pause <workflow-id>
|
|
39
|
+
fractary-faber resume <workflow-id>
|
|
40
|
+
|
|
41
|
+
# Recover from checkpoint
|
|
42
|
+
fractary-faber recover <workflow-id>
|
|
43
|
+
|
|
44
|
+
# Clean up old workflows
|
|
45
|
+
fractary-faber cleanup --max-age 30
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Work Commands
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Issue operations
|
|
52
|
+
fractary-faber work issue fetch 123
|
|
53
|
+
fractary-faber work issue create --title "New feature"
|
|
54
|
+
fractary-faber work issue update 123 --title "Updated"
|
|
55
|
+
fractary-faber work issue close 123
|
|
56
|
+
fractary-faber work issue search --query "bug fix"
|
|
57
|
+
|
|
58
|
+
# Comment operations
|
|
59
|
+
fractary-faber work comment create 123 --body "This is a comment"
|
|
60
|
+
fractary-faber work comment list 123
|
|
61
|
+
|
|
62
|
+
# Label operations
|
|
63
|
+
fractary-faber work label add 123 --label "bug,critical"
|
|
64
|
+
fractary-faber work label remove 123 --label "wontfix"
|
|
65
|
+
fractary-faber work label list
|
|
66
|
+
|
|
67
|
+
# Milestone operations
|
|
68
|
+
fractary-faber work milestone create --title "v1.0" --due-on "2025-12-31"
|
|
69
|
+
fractary-faber work milestone list
|
|
70
|
+
fractary-faber work milestone set 123 --milestone "v1.0"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Repository Commands
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Branch operations
|
|
77
|
+
fractary-faber repo branch create "feat/new-feature"
|
|
78
|
+
fractary-faber repo branch list
|
|
79
|
+
fractary-faber repo branch delete feat/old-feature
|
|
80
|
+
|
|
81
|
+
# Commit operations
|
|
82
|
+
fractary-faber repo commit "feat: add new feature"
|
|
83
|
+
|
|
84
|
+
# Pull request operations
|
|
85
|
+
fractary-faber repo pr create "Add new feature" --body "Description"
|
|
86
|
+
fractary-faber repo pr list
|
|
87
|
+
fractary-faber repo pr merge 42
|
|
88
|
+
fractary-faber repo pr review 42
|
|
89
|
+
|
|
90
|
+
# Tag operations
|
|
91
|
+
fractary-faber repo tag create v1.0.0
|
|
92
|
+
fractary-faber repo tag push v1.0.0
|
|
93
|
+
fractary-faber repo tag list
|
|
94
|
+
|
|
95
|
+
# Worktree operations
|
|
96
|
+
fractary-faber repo worktree create feat/new-feature
|
|
97
|
+
fractary-faber repo worktree list
|
|
98
|
+
fractary-faber repo worktree remove feat/new-feature
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Specification Commands
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Create specifications
|
|
105
|
+
fractary-faber spec create "My Specification"
|
|
106
|
+
|
|
107
|
+
# Get specification
|
|
108
|
+
fractary-faber spec get <id>
|
|
109
|
+
|
|
110
|
+
# List specifications
|
|
111
|
+
fractary-faber spec list
|
|
112
|
+
|
|
113
|
+
# Update specification
|
|
114
|
+
fractary-faber spec update <id> --title "Updated"
|
|
115
|
+
|
|
116
|
+
# Validate specification
|
|
117
|
+
fractary-faber spec validate <id>
|
|
118
|
+
|
|
119
|
+
# Refine specification
|
|
120
|
+
fractary-faber spec refine <id>
|
|
121
|
+
|
|
122
|
+
# Delete specification
|
|
123
|
+
fractary-faber spec delete <id>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Logs Commands
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Capture logs
|
|
130
|
+
fractary-faber logs capture <workflow-id>
|
|
131
|
+
|
|
132
|
+
# Stop capturing logs
|
|
133
|
+
fractary-faber logs stop <session-id>
|
|
134
|
+
|
|
135
|
+
# Write logs
|
|
136
|
+
fractary-faber logs write --message "Log message"
|
|
137
|
+
|
|
138
|
+
# Read logs
|
|
139
|
+
fractary-faber logs read <session-id>
|
|
140
|
+
|
|
141
|
+
# Search logs
|
|
142
|
+
fractary-faber logs search --query "error"
|
|
143
|
+
|
|
144
|
+
# List logs
|
|
145
|
+
fractary-faber logs list
|
|
146
|
+
|
|
147
|
+
# Archive logs
|
|
148
|
+
fractary-faber logs archive --older-than 30
|
|
149
|
+
|
|
150
|
+
# Delete logs
|
|
151
|
+
fractary-faber logs delete <session-id>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Configuration
|
|
155
|
+
|
|
156
|
+
FABER is configured via `.fractary/faber/config.json`:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"version": "1.0.0",
|
|
161
|
+
"preset": "default",
|
|
162
|
+
"work": {
|
|
163
|
+
"provider": "github"
|
|
164
|
+
},
|
|
165
|
+
"repo": {
|
|
166
|
+
"provider": "github",
|
|
167
|
+
"defaultBranch": "main"
|
|
168
|
+
},
|
|
169
|
+
"spec": {
|
|
170
|
+
"directory": ".fractary/faber/specs"
|
|
171
|
+
},
|
|
172
|
+
"logs": {
|
|
173
|
+
"directory": ".fractary/faber/logs"
|
|
174
|
+
},
|
|
175
|
+
"workflow": {
|
|
176
|
+
"defaultAutonomy": "guarded",
|
|
177
|
+
"phases": ["frame", "architect", "build", "evaluate", "release"],
|
|
178
|
+
"checkpoints": true
|
|
179
|
+
},
|
|
180
|
+
"state": {
|
|
181
|
+
"directory": ".fractary/faber/state"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Options
|
|
187
|
+
|
|
188
|
+
All commands support:
|
|
189
|
+
|
|
190
|
+
- `--json` - Output as JSON
|
|
191
|
+
- `--debug` - Enable debug output
|
|
192
|
+
- `--help` - Show command help
|
|
193
|
+
|
|
194
|
+
## Environment Variables
|
|
195
|
+
|
|
196
|
+
Configure providers via environment variables:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# GitHub
|
|
200
|
+
export GITHUB_TOKEN=<token>
|
|
201
|
+
|
|
202
|
+
# Jira
|
|
203
|
+
export JIRA_BASE_URL=<url>
|
|
204
|
+
export JIRA_USERNAME=<username>
|
|
205
|
+
export JIRA_API_TOKEN=<token>
|
|
206
|
+
|
|
207
|
+
# Linear
|
|
208
|
+
export LINEAR_API_KEY=<key>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Architecture
|
|
212
|
+
|
|
213
|
+
See [SPEC-00026: Distributed Plugin Architecture](../specs/SPEC-00026-distributed-plugin-architecture.md)
|
|
214
|
+
|
|
215
|
+
The CLI follows SPEC-00026 standards:
|
|
216
|
+
- Package: `@fractary/faber-cli`
|
|
217
|
+
- Binary: `fractary-faber`
|
|
218
|
+
- Located: `/cli` at root of repository
|
|
219
|
+
- Depends on: `@fractary/faber` SDK
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,iBAAiB,IAAI,OAAO,CAsE3C"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init command - Initialize a new FABER project
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
import * as fs from 'fs/promises';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
export function createInitCommand() {
|
|
9
|
+
return new Command('init')
|
|
10
|
+
.description('Initialize a new FABER project')
|
|
11
|
+
.option('--preset <name>', 'Use a preset configuration', 'default')
|
|
12
|
+
.option('--force', 'Overwrite existing configuration')
|
|
13
|
+
.option('--json', 'Output as JSON')
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
try {
|
|
16
|
+
const configDir = '.fractary/faber';
|
|
17
|
+
const configPath = path.join(configDir, 'config.json');
|
|
18
|
+
// Check if already initialized
|
|
19
|
+
const exists = await fs.access(configPath).then(() => true).catch(() => false);
|
|
20
|
+
if (exists && !options.force) {
|
|
21
|
+
if (options.json) {
|
|
22
|
+
console.log(JSON.stringify({
|
|
23
|
+
status: 'error',
|
|
24
|
+
error: { code: 'ALREADY_INITIALIZED', message: 'FABER already initialized. Use --force to reinitialize.' },
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
console.error(chalk.yellow('FABER already initialized. Use --force to reinitialize.'));
|
|
29
|
+
}
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
// Create directory structure
|
|
33
|
+
await fs.mkdir(configDir, { recursive: true });
|
|
34
|
+
await fs.mkdir(path.join(configDir, 'specs'), { recursive: true });
|
|
35
|
+
await fs.mkdir(path.join(configDir, 'logs'), { recursive: true });
|
|
36
|
+
await fs.mkdir(path.join(configDir, 'state'), { recursive: true });
|
|
37
|
+
// Create default configuration
|
|
38
|
+
const config = createDefaultConfig(options.preset);
|
|
39
|
+
await fs.writeFile(configPath, JSON.stringify(config, null, 2));
|
|
40
|
+
// Create .gitignore for sensitive files
|
|
41
|
+
const gitignore = `# FABER state files
|
|
42
|
+
state/*.json
|
|
43
|
+
logs/session-*.md
|
|
44
|
+
*.tmp
|
|
45
|
+
`;
|
|
46
|
+
await fs.writeFile(path.join(configDir, '.gitignore'), gitignore);
|
|
47
|
+
if (options.json) {
|
|
48
|
+
console.log(JSON.stringify({
|
|
49
|
+
status: 'success',
|
|
50
|
+
data: { configPath, preset: options.preset },
|
|
51
|
+
}, null, 2));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
console.log(chalk.green('✓ FABER initialized successfully'));
|
|
55
|
+
console.log(chalk.gray(` Config: ${configPath}`));
|
|
56
|
+
console.log(chalk.gray(` Preset: ${options.preset}`));
|
|
57
|
+
console.log('\nNext steps:');
|
|
58
|
+
console.log(' 1. Configure work tracking: Edit .fractary/faber/config.json');
|
|
59
|
+
console.log(' 2. Start a workflow: fractary-faber run --work-id <issue-number>');
|
|
60
|
+
console.log(' 3. Check status: fractary-faber status');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
65
|
+
if (options.json) {
|
|
66
|
+
console.error(JSON.stringify({
|
|
67
|
+
status: 'error',
|
|
68
|
+
error: { code: 'INIT_ERROR', message },
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
console.error(chalk.red('Error:'), message);
|
|
73
|
+
}
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Create default FABER configuration
|
|
80
|
+
*/
|
|
81
|
+
function createDefaultConfig(preset) {
|
|
82
|
+
const baseConfig = {
|
|
83
|
+
version: '1.0.0',
|
|
84
|
+
preset,
|
|
85
|
+
// Work tracking configuration
|
|
86
|
+
work: {
|
|
87
|
+
provider: 'github', // or 'jira', 'linear'
|
|
88
|
+
},
|
|
89
|
+
// Repository configuration
|
|
90
|
+
repo: {
|
|
91
|
+
provider: 'github', // or 'gitlab', 'bitbucket'
|
|
92
|
+
defaultBranch: 'main',
|
|
93
|
+
branchPrefix: 'feat/',
|
|
94
|
+
conventionalCommits: true,
|
|
95
|
+
},
|
|
96
|
+
// Specification configuration
|
|
97
|
+
spec: {
|
|
98
|
+
directory: '.fractary/faber/specs',
|
|
99
|
+
templates: {
|
|
100
|
+
feature: 'feature',
|
|
101
|
+
bugfix: 'bugfix',
|
|
102
|
+
refactor: 'refactor',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
// Log configuration
|
|
106
|
+
logs: {
|
|
107
|
+
directory: '.fractary/faber/logs',
|
|
108
|
+
retention: {
|
|
109
|
+
session: 30,
|
|
110
|
+
build: 90,
|
|
111
|
+
deployment: 365,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
// Workflow configuration
|
|
115
|
+
workflow: {
|
|
116
|
+
defaultAutonomy: 'guarded',
|
|
117
|
+
phases: ['frame', 'architect', 'build', 'evaluate', 'release'],
|
|
118
|
+
checkpoints: true,
|
|
119
|
+
},
|
|
120
|
+
// State management
|
|
121
|
+
state: {
|
|
122
|
+
directory: '.fractary/faber/state',
|
|
123
|
+
persistence: 'file', // or 'none' for stateless
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
// Apply preset modifications
|
|
127
|
+
switch (preset) {
|
|
128
|
+
case 'minimal':
|
|
129
|
+
return {
|
|
130
|
+
...baseConfig,
|
|
131
|
+
workflow: {
|
|
132
|
+
...baseConfig.workflow,
|
|
133
|
+
checkpoints: false,
|
|
134
|
+
},
|
|
135
|
+
logs: {
|
|
136
|
+
...baseConfig.logs,
|
|
137
|
+
retention: {
|
|
138
|
+
session: 7,
|
|
139
|
+
build: 30,
|
|
140
|
+
deployment: 90,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
case 'enterprise':
|
|
145
|
+
return {
|
|
146
|
+
...baseConfig,
|
|
147
|
+
workflow: {
|
|
148
|
+
...baseConfig.workflow,
|
|
149
|
+
defaultAutonomy: 'assist',
|
|
150
|
+
},
|
|
151
|
+
logs: {
|
|
152
|
+
...baseConfig.logs,
|
|
153
|
+
retention: {
|
|
154
|
+
session: 90,
|
|
155
|
+
build: 365,
|
|
156
|
+
deployment: 730,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
default:
|
|
161
|
+
return baseConfig;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs subcommand - Log management
|
|
3
|
+
*
|
|
4
|
+
* Provides capture, write, search, list, archive operations via LogManager SDK.
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
/**
|
|
8
|
+
* Create the logs command tree
|
|
9
|
+
*/
|
|
10
|
+
export declare function createLogsCommand(): Command;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/logs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAc3C"}
|