@context-forge/cli 0.2.2
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 +116 -0
- package/dist/commands/build.d.ts +3 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +51 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/check.d.ts +3 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +13 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +82 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/future.d.ts +3 -0
- package/dist/commands/future.d.ts.map +1 -0
- package/dist/commands/future.js +49 -0
- package/dist/commands/future.js.map +1 -0
- package/dist/commands/guides.d.ts +3 -0
- package/dist/commands/guides.d.ts.map +1 -0
- package/dist/commands/guides.js +116 -0
- package/dist/commands/guides.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +36 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/next.d.ts +3 -0
- package/dist/commands/next.d.ts.map +1 -0
- package/dist/commands/next.js +80 -0
- package/dist/commands/next.js.map +1 -0
- package/dist/commands/project.d.ts +3 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +239 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/prompt.d.ts +3 -0
- package/dist/commands/prompt.d.ts.map +1 -0
- package/dist/commands/prompt.js +111 -0
- package/dist/commands/prompt.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +79 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/output/formatter.d.ts +6 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +9 -0
- package/dist/output/formatter.js.map +1 -0
- package/dist/output/styles.d.ts +15 -0
- package/dist/output/styles.d.ts.map +1 -0
- package/dist/output/styles.js +16 -0
- package/dist/output/styles.js.map +1 -0
- package/dist/output/tables.d.ts +6 -0
- package/dist/output/tables.d.ts.map +1 -0
- package/dist/output/tables.js +42 -0
- package/dist/output/tables.js.map +1 -0
- package/dist/utils/errors.d.ts +13 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +27 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/phaseShorthand.d.ts +23 -0
- package/dist/utils/phaseShorthand.d.ts.map +1 -0
- package/dist/utils/phaseShorthand.js +68 -0
- package/dist/utils/phaseShorthand.js.map +1 -0
- package/dist/utils/project.d.ts +28 -0
- package/dist/utils/project.d.ts.map +1 -0
- package/dist/utils/project.js +81 -0
- package/dist/utils/project.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Manta Templates
|
|
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,116 @@
|
|
|
1
|
+
# @context-forge/cli
|
|
2
|
+
|
|
3
|
+
Terminal interface for Context Forge — context assembly, project management, workflow navigation, and configuration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
From the monorepo root:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm install
|
|
11
|
+
pnpm --filter @context-forge/cli build
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The `cf` binary is available via the workspace. For global install (future):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g @context-forge/cli
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Set your default project (by name or ID)
|
|
24
|
+
cf config set default_project orchestration
|
|
25
|
+
|
|
26
|
+
# Check project status (auto-detects from CWD)
|
|
27
|
+
cd ~/repos/orchestration && cf status
|
|
28
|
+
|
|
29
|
+
# Generate a context prompt and copy to clipboard
|
|
30
|
+
cf build | pbcopy
|
|
31
|
+
|
|
32
|
+
# Generate with phase override
|
|
33
|
+
cf build --phase task-breakdown
|
|
34
|
+
|
|
35
|
+
# View available prompt templates
|
|
36
|
+
cf prompt list
|
|
37
|
+
|
|
38
|
+
# Get a specific prompt with project variables substituted
|
|
39
|
+
cf prompt get P5
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Commands
|
|
43
|
+
|
|
44
|
+
| Command | Usage | Description |
|
|
45
|
+
|---------|-------|-------------|
|
|
46
|
+
| `cf status` | `cf status [--project <id>] [--json]` | Show workflow status for the active project |
|
|
47
|
+
| `cf next` | `cf next [--project <id>] [--json]` | Show recommended next action |
|
|
48
|
+
| `cf build` | `cf build [--project <id>] [--phase] [--slice] [--instruction] [--tasks] [--additional]` | Generate context prompt to stdout |
|
|
49
|
+
| `cf config` | `cf config list\|get\|set` | Manage configuration |
|
|
50
|
+
| `cf project` | `cf project list\|get\|set` | Manage projects |
|
|
51
|
+
| `cf future` | `cf future [--project <id>] [--status <filter>] [--json]` | Show consolidated future work |
|
|
52
|
+
| `cf check` | `cf check [--fix] [--json]` | Run consistency checks (stub — depends on slice 166) |
|
|
53
|
+
| `cf prompt` | `cf prompt list\|get <phase>` | Access prompt templates with variable substitution |
|
|
54
|
+
|
|
55
|
+
## Common Options
|
|
56
|
+
|
|
57
|
+
- `--project <name|id>` — Override the default project by name or ID (available on most commands)
|
|
58
|
+
- `--json` — Output as JSON (not applicable to `build` and `prompt get`)
|
|
59
|
+
|
|
60
|
+
## Phase Shorthands
|
|
61
|
+
|
|
62
|
+
`cf prompt get` and `cf build --phase` accept phase shorthands:
|
|
63
|
+
|
|
64
|
+
| Shorthand | Phase |
|
|
65
|
+
|-----------|-------|
|
|
66
|
+
| P1 | Concept |
|
|
67
|
+
| P2 | Architecture |
|
|
68
|
+
| P3 | Slice Planning |
|
|
69
|
+
| P4 | Slice Design |
|
|
70
|
+
| P5 | Task Breakdown |
|
|
71
|
+
| P6 | Implementation |
|
|
72
|
+
| P7 | Integration |
|
|
73
|
+
|
|
74
|
+
Shorthands are derived at runtime from the project's prompt asset file.
|
|
75
|
+
|
|
76
|
+
## Project Resolution
|
|
77
|
+
|
|
78
|
+
`cf` resolves which project to operate on using a three-level chain:
|
|
79
|
+
|
|
80
|
+
1. **`--project` flag** — highest priority. Accepts project name or ID.
|
|
81
|
+
2. **CWD detection** — if the current directory is inside a registered project's path, that project is used automatically.
|
|
82
|
+
3. **`default_project` config** — fallback when no flag or CWD match.
|
|
83
|
+
|
|
84
|
+
`cf status` displays which method was used: `(--project flag)`, `(from CWD)`, or `(default)`.
|
|
85
|
+
|
|
86
|
+
**Planned config key:** `default_additional_instruction` — not yet implemented. Will allow setting a default additional instruction appended to `cf build` output.
|
|
87
|
+
|
|
88
|
+
## Architecture
|
|
89
|
+
|
|
90
|
+
The CLI wraps `@context-forge/core` directly (no MCP layer), following the same pattern as the Electron package. All core services are imported from `@context-forge/core/node`.
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pnpm --filter @context-forge/cli build # Compile TypeScript
|
|
96
|
+
pnpm --filter @context-forge/cli dev # Watch mode
|
|
97
|
+
pnpm --filter @context-forge/cli test # Run tests
|
|
98
|
+
pnpm --filter @context-forge/cli typecheck # Type check
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Changelog
|
|
102
|
+
|
|
103
|
+
### v0.2.0
|
|
104
|
+
|
|
105
|
+
- **CWD-based project detection** — `cf` auto-detects the project from your current directory
|
|
106
|
+
- **Name-based resolution** — use `--project orchestration` or `cf config set default_project orchestration` with project names instead of IDs
|
|
107
|
+
- **Resolution indicators** — `cf status` shows how the project was resolved (`from CWD`, `default`, `--project flag`)
|
|
108
|
+
- **Compact `cf project list`** — Name/Path/Slice/Default columns with `●` default indicator and `~` path shortening
|
|
109
|
+
- **Tighter output formatting** — consistent label alignment, suppressed empty fields, standardized error messages
|
|
110
|
+
|
|
111
|
+
### v0.1.0
|
|
112
|
+
|
|
113
|
+
- Initial release with 8 commands: `status`, `next`, `build`, `config`, `project`, `future`, `check`, `prompt`
|
|
114
|
+
- Integration with `@context-forge/core` for context assembly
|
|
115
|
+
- Phase shorthands for prompt templates
|
|
116
|
+
- JSON output mode on all applicable commands
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiD3D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FileProjectStore, createContextPipeline } from '@context-forge/core/node';
|
|
2
|
+
import { resolveProjectId } from '../utils/project.js';
|
|
3
|
+
import { handleError, UserError } from '../utils/errors.js';
|
|
4
|
+
import { printRaw } from '../output/formatter.js';
|
|
5
|
+
export function registerBuildCommand(program) {
|
|
6
|
+
program
|
|
7
|
+
.command('build')
|
|
8
|
+
.description('Generate and output a context prompt to stdout (--json not applicable)')
|
|
9
|
+
.option('--project <id>', 'Project ID (overrides default)')
|
|
10
|
+
.option('--phase <phase>', 'Override development phase')
|
|
11
|
+
.option('--slice <slice>', 'Override slice name')
|
|
12
|
+
.option('--instruction <instruction>', 'Override instruction type')
|
|
13
|
+
.option('--tasks <tasks>', 'Override task file name')
|
|
14
|
+
.option('--additional <text>', 'Additional instructions to append')
|
|
15
|
+
.action(async (opts) => {
|
|
16
|
+
try {
|
|
17
|
+
const store = new FileProjectStore();
|
|
18
|
+
const { id } = await resolveProjectId(opts.project, store);
|
|
19
|
+
const project = await store.getById(id);
|
|
20
|
+
if (!project) {
|
|
21
|
+
throw new UserError(`Project not found: '${id}'. Run cf project list to see available projects.`);
|
|
22
|
+
}
|
|
23
|
+
if (!project.projectPath) {
|
|
24
|
+
throw new UserError(`Project '${project.name}' has no projectPath configured.\n` +
|
|
25
|
+
' cf project set projectPath /path/to/project');
|
|
26
|
+
}
|
|
27
|
+
// Status message goes to stderr so stdout stays clean for piping
|
|
28
|
+
process.stderr.write(`Building context for ${project.name}...\n`);
|
|
29
|
+
// Apply overrides to a working copy
|
|
30
|
+
const workingCopy = { ...project };
|
|
31
|
+
if (opts.phase)
|
|
32
|
+
workingCopy.developmentPhase = opts.phase;
|
|
33
|
+
if (opts.slice)
|
|
34
|
+
workingCopy.fileSlice = opts.slice;
|
|
35
|
+
if (opts.instruction)
|
|
36
|
+
workingCopy.instruction = opts.instruction;
|
|
37
|
+
if (opts.tasks)
|
|
38
|
+
workingCopy.fileTasks = opts.tasks;
|
|
39
|
+
const { integrator } = createContextPipeline(workingCopy.projectPath);
|
|
40
|
+
let contextString = await integrator.generateContextFromProject(workingCopy);
|
|
41
|
+
if (opts.additional) {
|
|
42
|
+
contextString = `${contextString}\n\n${opts.additional}`;
|
|
43
|
+
}
|
|
44
|
+
printRaw(contextString);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
handleError(err);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAWlD,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,wEAAwE,CAAC;SACrF,MAAM,CAAC,gBAAgB,EAAE,gCAAgC,CAAC;SAC1D,MAAM,CAAC,iBAAiB,EAAE,4BAA4B,CAAC;SACvD,MAAM,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;SAChD,MAAM,CAAC,6BAA6B,EAAE,2BAA2B,CAAC;SAClE,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;SACpD,MAAM,CAAC,qBAAqB,EAAE,mCAAmC,CAAC;SAClE,MAAM,CAAC,KAAK,EAAE,IAAe,EAAE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,aAAa,GAAG,GAAG,aAAa,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;YAC3D,CAAC;YAED,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAU3D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { dim } from '../output/styles.js';
|
|
2
|
+
export function registerCheckCommand(program) {
|
|
3
|
+
program
|
|
4
|
+
.command('check')
|
|
5
|
+
.description('Run consistency checks on project artifacts')
|
|
6
|
+
.option('--json', 'Output as JSON')
|
|
7
|
+
.option('--project <id>', 'Project ID (overrides default)')
|
|
8
|
+
.option('--fix', 'Apply non-destructive corrections (when available)')
|
|
9
|
+
.action(async () => {
|
|
10
|
+
console.log(dim('cf check: Consistency checker not yet available. Depends on slice 166.'));
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,6CAA6C,CAAC;SAC1D,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,gBAAgB,EAAE,gCAAgC,CAAC;SAC1D,MAAM,CAAC,OAAO,EAAE,oDAAoD,CAAC;SACrE,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+E5D"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ConfigManager } from '@context-forge/core/node';
|
|
2
|
+
import { handleError } from '../utils/errors.js';
|
|
3
|
+
import { printJson } from '../output/formatter.js';
|
|
4
|
+
import { label, value as valueStyle, dim, success } from '../output/styles.js';
|
|
5
|
+
export function registerConfigCommand(program) {
|
|
6
|
+
const cmd = program
|
|
7
|
+
.command('config')
|
|
8
|
+
.description('Manage Context Forge configuration');
|
|
9
|
+
cmd
|
|
10
|
+
.command('list')
|
|
11
|
+
.description('List all configuration keys and values')
|
|
12
|
+
.option('--json', 'Output as JSON')
|
|
13
|
+
.option('--project <path>', 'Include project-level config from this path')
|
|
14
|
+
.action(async (opts) => {
|
|
15
|
+
try {
|
|
16
|
+
const cm = new ConfigManager(opts.project);
|
|
17
|
+
const entries = await cm.list();
|
|
18
|
+
if (opts.json) {
|
|
19
|
+
printJson(entries);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Aligned text output matching orchestration style
|
|
23
|
+
const maxKey = Math.max(...entries.map((e) => e.key.length));
|
|
24
|
+
const maxVal = Math.max(...entries.map((e) => String(e.value ?? '').length), 5);
|
|
25
|
+
for (const e of entries) {
|
|
26
|
+
const val = String(e.value ?? '');
|
|
27
|
+
console.log(` ${e.key.padEnd(maxKey)} ${valueStyle(val.padEnd(maxVal))} ${dim(e.source)}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
handleError(err);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
cmd
|
|
35
|
+
.command('get <key>')
|
|
36
|
+
.description('Get the value of a configuration key')
|
|
37
|
+
.option('--json', 'Output as JSON')
|
|
38
|
+
.option('--project <path>', 'Include project-level config from this path')
|
|
39
|
+
.action(async (key, opts) => {
|
|
40
|
+
try {
|
|
41
|
+
const cm = new ConfigManager(opts.project);
|
|
42
|
+
const result = await cm.get(key);
|
|
43
|
+
if (opts.json) {
|
|
44
|
+
printJson(result);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
console.log(`${label('Key:')} ${result.key}`);
|
|
48
|
+
console.log(`${label('Value:')} ${valueStyle(String(result.value ?? ''))}`);
|
|
49
|
+
console.log(`${label('Source:')} ${result.source}`);
|
|
50
|
+
if (result.description) {
|
|
51
|
+
console.log(`${label('About:')} ${result.description}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
handleError(err);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
cmd
|
|
59
|
+
.command('set <key> <value>')
|
|
60
|
+
.description('Set a configuration value')
|
|
61
|
+
.option('--project <path>', 'Write to project-level config at this path')
|
|
62
|
+
.action(async (key, val, opts) => {
|
|
63
|
+
try {
|
|
64
|
+
const scope = opts.project ? 'project' : 'user';
|
|
65
|
+
const cm = new ConfigManager(opts.project);
|
|
66
|
+
// Coerce booleans and numbers
|
|
67
|
+
let coerced = val;
|
|
68
|
+
if (val === 'true')
|
|
69
|
+
coerced = true;
|
|
70
|
+
else if (val === 'false')
|
|
71
|
+
coerced = false;
|
|
72
|
+
else if (/^\d+(\.\d+)?$/.test(val))
|
|
73
|
+
coerced = Number(val);
|
|
74
|
+
await cm.set(key, coerced, scope);
|
|
75
|
+
console.log(success(`Set ${key} = ${String(coerced)} (${scope})`));
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
handleError(err);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,GAAG,GAAG,OAAO;SAChB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,oCAAoC,CAAC,CAAC;IAErD,GAAG;SACA,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,wCAAwC,CAAC;SACrD,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,kBAAkB,EAAE,6CAA6C,CAAC;SACzE,MAAM,CAAC,KAAK,EAAE,IAA0C,EAAE,EAAE;QAC3D,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3C,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;YAEhC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBACd,SAAS,CAAC,OAAO,CAAC,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,mDAAmD;YACnD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM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,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"future.d.ts","sourceRoot":"","sources":["../../src/commands/future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmD5D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FileProjectStore, FutureWorkCollector } from '@context-forge/core/node';
|
|
2
|
+
import { resolveProjectId } from '../utils/project.js';
|
|
3
|
+
import { handleError, UserError } from '../utils/errors.js';
|
|
4
|
+
import { printJson } from '../output/formatter.js';
|
|
5
|
+
import { label, value as valueStyle, dim, success } from '../output/styles.js';
|
|
6
|
+
export function registerFutureCommand(program) {
|
|
7
|
+
program
|
|
8
|
+
.command('future')
|
|
9
|
+
.description('Show consolidated future work across slice plans')
|
|
10
|
+
.option('--json', 'Output as JSON')
|
|
11
|
+
.option('--project <id>', 'Project ID (overrides default)')
|
|
12
|
+
.option('--status <filter>', 'Filter by status: all, pending, completed', 'all')
|
|
13
|
+
.action(async (opts) => {
|
|
14
|
+
try {
|
|
15
|
+
const store = new FileProjectStore();
|
|
16
|
+
const { id } = await resolveProjectId(opts.project, store);
|
|
17
|
+
const project = await store.getById(id);
|
|
18
|
+
if (!project) {
|
|
19
|
+
throw new UserError(`Project not found: '${id}'. Run cf project list to see available projects.`);
|
|
20
|
+
}
|
|
21
|
+
if (!project.projectPath) {
|
|
22
|
+
throw new UserError(`Project '${project.name}' has no projectPath configured.\n` +
|
|
23
|
+
' cf project set projectPath /path/to/project');
|
|
24
|
+
}
|
|
25
|
+
const statusFilter = opts.status;
|
|
26
|
+
const collector = new FutureWorkCollector();
|
|
27
|
+
const result = await collector.collect(project.projectPath, statusFilter);
|
|
28
|
+
if (opts.json) {
|
|
29
|
+
printJson(result);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// Terminal output: grouped by initiative
|
|
33
|
+
for (const group of result.groups) {
|
|
34
|
+
console.log(label(`\n${group.initiativeName}`));
|
|
35
|
+
for (const item of group.items) {
|
|
36
|
+
const marker = item.done ? success('[x]') : dim('[ ]');
|
|
37
|
+
console.log(` ${marker} ${item.name}`);
|
|
38
|
+
}
|
|
39
|
+
console.log(dim(` ${group.completedItems}/${group.totalItems} complete`));
|
|
40
|
+
}
|
|
41
|
+
console.log('');
|
|
42
|
+
console.log(valueStyle(`Total: ${result.totalItems} items, ${result.pendingItems} pending`));
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
handleError(err);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=future.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"future.js","sourceRoot":"","sources":["../../src/commands/future.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,UAAU,qBAAqB,CAAC,OAAgB;I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AAC,CAAC,CAAC;gBAChD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;oBAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;oBACvD,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC1C,CAAC;gBACD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,UAAU,WAAW,CAAC,CAAC,CAAC;YAC7E,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CACT,UAAU,CAAC,UAAU,MAAM,CAAC,UAAU,WAAW,MAAM,CAAC,YAAY,UAAU,CAAC,CAChF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guides.d.ts","sourceRoot":"","sources":["../../src/commands/guides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwDpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwE5D"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { FileProjectStore, GuideManager, ConfigManager } from '@context-forge/core/node';
|
|
3
|
+
import { resolveProjectId } from '../utils/project.js';
|
|
4
|
+
import { handleError, UserError } from '../utils/errors.js';
|
|
5
|
+
import { printJson } from '../output/formatter.js';
|
|
6
|
+
import { label, value as valueStyle, dim, success, warn } from '../output/styles.js';
|
|
7
|
+
/** Resolve project path from --project flag or CWD/default */
|
|
8
|
+
async function getProjectPath(projectOpt) {
|
|
9
|
+
const store = new FileProjectStore();
|
|
10
|
+
const { id } = await resolveProjectId(projectOpt, store);
|
|
11
|
+
const project = await store.getById(id);
|
|
12
|
+
if (!project) {
|
|
13
|
+
throw new UserError(`Project not found: '${id}'.`);
|
|
14
|
+
}
|
|
15
|
+
if (!project.projectPath) {
|
|
16
|
+
throw new UserError(`Project '${project.name}' has no configured project path.\n` +
|
|
17
|
+
' Run cf init in the project directory to set the path.');
|
|
18
|
+
}
|
|
19
|
+
return project.projectPath;
|
|
20
|
+
}
|
|
21
|
+
/** Show guide status */
|
|
22
|
+
async function showStatus(opts) {
|
|
23
|
+
const projectPath = await getProjectPath(opts.project);
|
|
24
|
+
const cm = new ConfigManager(projectPath);
|
|
25
|
+
const manager = new GuideManager(projectPath, cm);
|
|
26
|
+
const info = await manager.status();
|
|
27
|
+
if (opts.json) {
|
|
28
|
+
printJson(info);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
console.log(label('Guide Status'));
|
|
32
|
+
console.log(` ${label('Installed:')} ${info.installed ? valueStyle('yes') : dim('no')}`);
|
|
33
|
+
if (info.installed) {
|
|
34
|
+
console.log(` ${label('Method:')} ${valueStyle(info.method ?? 'unknown')}`);
|
|
35
|
+
console.log(` ${label('Version:')} ${valueStyle(info.version ?? 'unknown')}`);
|
|
36
|
+
console.log(` ${label('Path:')} ${dim(info.path)}`);
|
|
37
|
+
if (info.updateAvailable) {
|
|
38
|
+
console.log(` ${label('Update:')} ${warn(`${info.latestVersion} available`)}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
console.log(` ${label('Bundled:')} ${valueStyle('using bundled system prompt')}`);
|
|
43
|
+
console.log(` ${dim(' Run cf guides install to install the full guide.')}`);
|
|
44
|
+
}
|
|
45
|
+
if (info.latestVersion) {
|
|
46
|
+
console.log(` ${label('Latest:')} ${dim(info.latestVersion)}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function registerGuidesCommand(program) {
|
|
50
|
+
const cmd = program
|
|
51
|
+
.command('guides')
|
|
52
|
+
.description('Manage AI project guide installation and updates');
|
|
53
|
+
// cf guides info (also the default for bare `cf guides`)
|
|
54
|
+
const infoCmd = new Command('info')
|
|
55
|
+
.description('Show guide installation status (default)')
|
|
56
|
+
.option('--json', 'Output as JSON')
|
|
57
|
+
.option('--project <name|id>', 'Project name or ID')
|
|
58
|
+
.action(async (opts) => {
|
|
59
|
+
try {
|
|
60
|
+
await showStatus(opts);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
handleError(err);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
cmd.addCommand(infoCmd, { isDefault: true });
|
|
67
|
+
// cf guides install
|
|
68
|
+
cmd
|
|
69
|
+
.command('install')
|
|
70
|
+
.description('Install the AI project guide')
|
|
71
|
+
.option('--strategy <method>', 'Installation strategy: submodule, clone, or manual')
|
|
72
|
+
.option('--source <url>', 'Source repository URL')
|
|
73
|
+
.option('--project <name|id>', 'Project name or ID')
|
|
74
|
+
.action(async (opts) => {
|
|
75
|
+
try {
|
|
76
|
+
const projectPath = await getProjectPath(opts.project);
|
|
77
|
+
const cm = new ConfigManager(projectPath);
|
|
78
|
+
const manager = new GuideManager(projectPath, cm);
|
|
79
|
+
const strategy = opts.strategy;
|
|
80
|
+
const result = await manager.install(strategy, opts.source);
|
|
81
|
+
console.log(success('Guide installed successfully.'));
|
|
82
|
+
console.log(` ${label('Version:')} ${valueStyle(result.version ?? 'unknown')}`);
|
|
83
|
+
console.log(` ${label('Method:')} ${valueStyle(result.method)}`);
|
|
84
|
+
console.log(` ${label('Path:')} ${dim(result.path)}`);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
handleError(err);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
// cf guides update
|
|
91
|
+
cmd
|
|
92
|
+
.command('update')
|
|
93
|
+
.description('Update an existing guide installation')
|
|
94
|
+
.option('--project <name|id>', 'Project name or ID')
|
|
95
|
+
.action(async (opts) => {
|
|
96
|
+
try {
|
|
97
|
+
const projectPath = await getProjectPath(opts.project);
|
|
98
|
+
const cm = new ConfigManager(projectPath);
|
|
99
|
+
const manager = new GuideManager(projectPath, cm);
|
|
100
|
+
const result = await manager.update();
|
|
101
|
+
if (result.previousVersion === result.newVersion) {
|
|
102
|
+
console.log(success('Guide is already at the latest version.'));
|
|
103
|
+
console.log(` ${label('Version:')} ${valueStyle(result.newVersion ?? 'unknown')}`);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
console.log(success('Guide updated successfully.'));
|
|
107
|
+
console.log(` ${label('Version:')} ${dim(result.previousVersion ?? 'unknown')} → ${valueStyle(result.newVersion ?? 'unknown')}`);
|
|
108
|
+
console.log(` ${label('Method:')} ${valueStyle(result.method)}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
handleError(err);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=guides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guides.js","sourceRoot":"","sources":["../../src/commands/guides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAErF,8DAA8D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AAC,CAAC;gBACpD,OAAO,CAAC,GAAG,CACT,KAAK,KAAK,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,eAAe,IAAI,SAAS,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,UAAU,IAAI,SAAS,CAAC,EAAE,CACtH,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiC1D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import { FileProjectStore } from '@context-forge/core/node';
|
|
3
|
+
import { handleError } from '../utils/errors.js';
|
|
4
|
+
import { success, warn } from '../output/styles.js';
|
|
5
|
+
export function registerInitCommand(program) {
|
|
6
|
+
program
|
|
7
|
+
.command('init')
|
|
8
|
+
.description('Register the current directory as a Context Forge project')
|
|
9
|
+
.option('--name <name>', 'Project name (defaults to directory basename)')
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
try {
|
|
12
|
+
const cwd = path.resolve(process.cwd());
|
|
13
|
+
const store = new FileProjectStore();
|
|
14
|
+
const all = await store.getAll();
|
|
15
|
+
// Check if a project with this path already exists
|
|
16
|
+
const existing = all.find((p) => p.projectPath === cwd);
|
|
17
|
+
if (existing) {
|
|
18
|
+
console.log(warn(`Project '${existing.name}' is already registered at this path.`));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const projectName = opts.name || path.basename(cwd);
|
|
22
|
+
await store.create({
|
|
23
|
+
name: projectName,
|
|
24
|
+
projectPath: cwd,
|
|
25
|
+
template: 'default',
|
|
26
|
+
fileSlice: '',
|
|
27
|
+
instruction: 'implementation',
|
|
28
|
+
});
|
|
29
|
+
console.log(success(`Initialized project '${projectName}' at ${cwd}`));
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
handleError(err);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,2DAA2D,CAAC;SACxE,MAAM,CAAC,eAAe,EAAE,+CAA+C,CAAC;SACxE,MAAM,CAAC,KAAK,EAAE,IAAuB,EAAE,EAAE;QACxC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACxC,MAAM,KAAK,GAAG,IAAI,gBAAgB,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC;YAEjC,mDAAmD;YACnD,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAA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