@context-forge/cli 0.12.0 → 0.13.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/commands/codex/cf-build/SKILL.md +17 -0
- package/commands/codex/cf-check/SKILL.md +12 -0
- package/commands/codex/cf-get/SKILL.md +11 -0
- package/commands/codex/cf-next/SKILL.md +11 -0
- package/commands/codex/cf-onboard/SKILL.md +61 -0
- package/commands/codex/cf-project/SKILL.md +13 -0
- package/commands/codex/cf-prompt/SKILL.md +16 -0
- package/commands/codex/cf-set/SKILL.md +12 -0
- package/commands/codex/cf-status/SKILL.md +11 -0
- package/dist/commands/commandInstaller.d.ts +54 -18
- package/dist/commands/commandInstaller.d.ts.map +1 -1
- package/dist/commands/commandInstaller.js +162 -61
- package/dist/commands/commandInstaller.js.map +1 -1
- package/dist/commands/ideTargets.d.ts +16 -0
- package/dist/commands/ideTargets.d.ts.map +1 -0
- package/dist/commands/ideTargets.js +36 -0
- package/dist/commands/ideTargets.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +17 -7
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/setup-ide.d.ts +2 -7
- package/dist/commands/setup-ide.d.ts.map +1 -1
- package/dist/commands/setup-ide.js +10 -27
- package/dist/commands/setup-ide.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf-build
|
|
3
|
+
description: Build and load a Context Forge context prompt. Use when the user asks to build, load, or refresh Context Forge context, optionally for a particular phase or slice.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Forge Build
|
|
7
|
+
|
|
8
|
+
1. Run `cf build --json` from the project root. If the user supplied a phase
|
|
9
|
+
or slice, pass it with `--phase <phase>` or `--slice <slice>`.
|
|
10
|
+
2. If the command fails, show its error output and stop.
|
|
11
|
+
3. Use the returned prompt as your working context.
|
|
12
|
+
4. Confirm receipt with exactly one line:
|
|
13
|
+
`Context loaded: {project} | {phase} | {slice}` — take the three values
|
|
14
|
+
from the command's output.
|
|
15
|
+
5. Follow the instruction prompt contained in the generated context.
|
|
16
|
+
6. If the instruction prompt contains a STOP condition, STOP — do not begin
|
|
17
|
+
work; request the required input instead.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf-check
|
|
3
|
+
description: Run Context Forge consistency checks on project artifacts. Use when the user asks to check, fix, or audit cf project document consistency.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Forge Check
|
|
7
|
+
|
|
8
|
+
1. Run `cf check` from the project root. Pass through any options the user
|
|
9
|
+
supplied (e.g. `--fix`, `--slice <index>`).
|
|
10
|
+
2. Print the command's output verbatim. Add no commentary, summary, or
|
|
11
|
+
interpretation.
|
|
12
|
+
3. If the command fails, show its error output instead.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf-get
|
|
3
|
+
description: Show all fields for the active Context Forge project. Use when the user asks to see the cf project's fields or configuration.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Forge Get
|
|
7
|
+
|
|
8
|
+
1. Run `cf get` from the project root.
|
|
9
|
+
2. Print the command's output verbatim. Add no commentary, summary, or
|
|
10
|
+
interpretation.
|
|
11
|
+
3. If the command fails, show its error output instead.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf-next
|
|
3
|
+
description: Show the recommended next action for the current Context Forge project. Use when the user asks what to do next in the cf workflow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Forge Next
|
|
7
|
+
|
|
8
|
+
1. Run `cf next` from the project root.
|
|
9
|
+
2. Print the command's output verbatim. Add no commentary, summary, or
|
|
10
|
+
interpretation.
|
|
11
|
+
3. If the command fails, show its error output instead.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf-onboard
|
|
3
|
+
description: Guide a user through Context Forge project setup and into their first phase of work. Use when the user wants to set up or onboard a project with Context Forge.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Forge Onboard
|
|
7
|
+
|
|
8
|
+
You are guiding a user through Context Forge project onboarding. Follow these
|
|
9
|
+
steps in order — skip any step whose precondition is already met.
|
|
10
|
+
|
|
11
|
+
## Step 1 — Detect existing project
|
|
12
|
+
|
|
13
|
+
Run `cf project list` and check whether a project is already registered at
|
|
14
|
+
the current working directory.
|
|
15
|
+
|
|
16
|
+
- If a project exists at this path → skip to Step 3.
|
|
17
|
+
- If no project exists → continue to Step 2.
|
|
18
|
+
|
|
19
|
+
## Step 2 — Create project
|
|
20
|
+
|
|
21
|
+
Ask the user what they'd like to name their project. If they provided a name
|
|
22
|
+
with the request, use that. If the user declines to choose, default to the
|
|
23
|
+
current directory name.
|
|
24
|
+
|
|
25
|
+
Run `cf init <name>`. This single command handles everything: git
|
|
26
|
+
initialization, project registration, guide installation, command/skill
|
|
27
|
+
installation, and IDE setup. After `cf init` completes, continue to Step 3.
|
|
28
|
+
|
|
29
|
+
**Important:** Do not rely on environment context (like "Is a git
|
|
30
|
+
repository") to determine git status — `cf init` checks the actual directory
|
|
31
|
+
and handles git initialization itself.
|
|
32
|
+
|
|
33
|
+
If the Context Forge MCP server is configured and shell access is
|
|
34
|
+
unavailable, fall back to its `project_create` tool (with `name` and
|
|
35
|
+
`projectPath` set to the CWD) followed by `guide_install`. The MCP fallback
|
|
36
|
+
cannot initialize git — if the directory is not a git repository, inform the
|
|
37
|
+
user they need to run `git init` first.
|
|
38
|
+
|
|
39
|
+
## Step 3 — Transition to concept discussion
|
|
40
|
+
|
|
41
|
+
The project is set up. Run `cf build` and use the output as your working
|
|
42
|
+
context to begin the Phase 0 (Concept) conversation.
|
|
43
|
+
|
|
44
|
+
Begin by asking the user to describe what they want to build. Guide them
|
|
45
|
+
through the concept exploration naturally — the context prompt provides the
|
|
46
|
+
structure. The goal is a concept document at the end of this conversation.
|
|
47
|
+
|
|
48
|
+
## Step 4 — Mention ongoing guidance
|
|
49
|
+
|
|
50
|
+
After the concept conversation concludes (or if the user wants to pause),
|
|
51
|
+
mention: "You can run `cf next` (or the `cf-next` skill) anytime to see what
|
|
52
|
+
to do next. It adapts as your project progresses."
|
|
53
|
+
|
|
54
|
+
## Notes
|
|
55
|
+
|
|
56
|
+
- If an MCP tool call fails, fall back to the CLI equivalent.
|
|
57
|
+
- If the user already has a project but is in a later phase (not Phase 0),
|
|
58
|
+
acknowledge this and suggest `cf next` instead of starting a concept
|
|
59
|
+
discussion.
|
|
60
|
+
- Keep the conversation natural. This is onboarding, not a checklist.
|
|
61
|
+
Adapt to what the user is telling you.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf-project
|
|
3
|
+
description: Manage Context Forge projects (list, get, set, rm, schema). Use when the user asks to list cf projects or manage project registration.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Forge Project
|
|
7
|
+
|
|
8
|
+
1. Run `cf project` from the project root, passing through the user's
|
|
9
|
+
subcommand and arguments (e.g. `cf project list`, `cf project get`,
|
|
10
|
+
`cf project set <field> <value>`, `cf project rm`, `cf project --schema`).
|
|
11
|
+
2. Print the command's output verbatim. Add no commentary, summary, or
|
|
12
|
+
interpretation.
|
|
13
|
+
3. If the command fails, show its error output instead.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf-prompt
|
|
3
|
+
description: Get or list Context Forge prompt templates. Use when the user asks for a cf prompt by phase name or wants the list of available prompts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Forge Prompt
|
|
7
|
+
|
|
8
|
+
1. If the user gave no argument, or the argument is `list`: run
|
|
9
|
+
`cf prompt list` and print its output verbatim, without commentary.
|
|
10
|
+
2. Otherwise run `cf prompt get <argument>` with the user's argument
|
|
11
|
+
(a phase name such as those shown by `cf prompt list`).
|
|
12
|
+
3. If the command fails, show its error output and stop.
|
|
13
|
+
4. When `cf prompt get` returns a prompt template: use it as your working
|
|
14
|
+
context and immediately begin the work it describes. Confirm receipt
|
|
15
|
+
with exactly one line: `Received prompt: {phase name}` — take the phase
|
|
16
|
+
name from the command's output.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf-set
|
|
3
|
+
description: Set a field on the active Context Forge project (e.g. phase, slice). Use when the user asks to set or change a cf project field.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Forge Set
|
|
7
|
+
|
|
8
|
+
1. Run `cf set <field> <value>` from the project root, using the field and
|
|
9
|
+
value the user supplied. If either is missing, ask for it — do not guess.
|
|
10
|
+
2. Print the command's output verbatim. Add no commentary, summary, or
|
|
11
|
+
interpretation.
|
|
12
|
+
3. If the command fails, show its error output instead.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf-status
|
|
3
|
+
description: Show Context Forge project status (phase, slice, task progress). Use when the user asks for cf status or where the project stands.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Forge Status
|
|
7
|
+
|
|
8
|
+
1. Run `cf status` from the project root.
|
|
9
|
+
2. Print the command's output verbatim. Add no commentary, summary, or
|
|
10
|
+
interpretation.
|
|
11
|
+
3. If the command fails, show its error output instead.
|
|
@@ -1,28 +1,64 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
/**
|
|
3
|
-
export
|
|
2
|
+
/** Targets that receive command/skill delivery. `copilot`/`cursor` have no known mechanism yet. */
|
|
3
|
+
export type CommandTarget = 'claude' | 'agents';
|
|
4
|
+
export interface CommandTargetDescriptor {
|
|
5
|
+
/** Bundled asset subdirectory under commands/. */
|
|
6
|
+
sourceDir: string;
|
|
7
|
+
/** Project-relative install directory (project-local scope, the default). */
|
|
8
|
+
localDir: string;
|
|
9
|
+
/** Machine-level install directory (--global scope). */
|
|
10
|
+
globalDir: () => string;
|
|
11
|
+
/** Install/prune strategy: flat .md files under cf/, or one directory per skill. */
|
|
12
|
+
layout: 'flat-md' | 'skill-dirs';
|
|
13
|
+
/** Maps a raw installed entry name to how the user invokes it. */
|
|
14
|
+
invocationHint: (entry: string) => string;
|
|
15
|
+
/** Noun used in messages ("commands" vs "skills"). */
|
|
16
|
+
noun: string;
|
|
17
|
+
label: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One entry per deliverable target — the `Record<CommandTarget, …>` annotation
|
|
21
|
+
* makes the compiler reject a CommandTarget without a descriptor.
|
|
22
|
+
*/
|
|
23
|
+
export declare const COMMAND_TARGETS: Record<CommandTarget, CommandTargetDescriptor>;
|
|
4
24
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @returns Object with installed and removed filenames.
|
|
25
|
+
* Resolve user input ('claude', 'codex', 'openai', 'agents', …) to a deliverable
|
|
26
|
+
* command target. Throws UserError for unknown targets and for valid IDE targets
|
|
27
|
+
* with no command delivery (copilot, cursor) — an explicit error, not a no-op.
|
|
10
28
|
*/
|
|
11
|
-
export declare function
|
|
29
|
+
export declare function resolveCommandTarget(input: string): CommandTarget;
|
|
30
|
+
export interface InstallScopeOptions {
|
|
31
|
+
/** Install to the machine-level directory instead of project-local. */
|
|
32
|
+
global?: boolean;
|
|
33
|
+
/** Explicit directory override — beats both scopes. */
|
|
34
|
+
targetDir?: string;
|
|
35
|
+
}
|
|
36
|
+
/** Resolve the install directory for a target and scope. Project-local is the default. */
|
|
37
|
+
export declare function resolveInstallDir(target: CommandTarget, opts?: InstallScopeOptions): string;
|
|
38
|
+
/** Resolve the bundled commands/ directory relative to this script's location. */
|
|
39
|
+
export declare function getSourceCommandsDir(): string;
|
|
40
|
+
export interface InstallResult {
|
|
12
41
|
installed: string[];
|
|
13
42
|
removed: string[];
|
|
14
|
-
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Install a target's bundled command assets into targetDir (layout per descriptor).
|
|
46
|
+
* Creates directories as needed, overwrites existing files (idempotent), and
|
|
47
|
+
* removes stale managed entries no longer present in the source.
|
|
48
|
+
*/
|
|
49
|
+
export declare function installCommands(target: CommandTarget, targetDir: string): InstallResult;
|
|
15
50
|
/**
|
|
16
|
-
* Remove managed command
|
|
17
|
-
* "Managed" =
|
|
18
|
-
* Preserves user-added
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @returns List of removed filenames.
|
|
51
|
+
* Remove managed command assets from the target.
|
|
52
|
+
* "Managed" = entries present in the bundled source for this target.
|
|
53
|
+
* Preserves user-added entries. flat-md removes cf/ if left empty; skill-dirs
|
|
54
|
+
* never removes the parent directory (it is shared with other skills).
|
|
55
|
+
* Idempotent — no error if files or directories don't exist.
|
|
22
56
|
*/
|
|
23
|
-
export declare function uninstallCommands(targetDir: string): string[];
|
|
24
|
-
/** Install
|
|
25
|
-
export declare function
|
|
57
|
+
export declare function uninstallCommands(target: CommandTarget, targetDir: string): string[];
|
|
58
|
+
/** Install and report for an already-resolved command target. Errors propagate. */
|
|
59
|
+
export declare function installCommandsForTarget(target: CommandTarget, opts?: InstallScopeOptions): void;
|
|
60
|
+
/** Install and report, resolving the target from user input. Errors propagate. */
|
|
61
|
+
export declare function installCommandsAction(ide?: string, opts?: InstallScopeOptions): void;
|
|
26
62
|
export declare function registerInstallCommandsCommand(program: Command): void;
|
|
27
63
|
export declare function registerUninstallCommandsCommand(program: Command): void;
|
|
28
64
|
//# sourceMappingURL=commandInstaller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandInstaller.d.ts","sourceRoot":"","sources":["../../src/commands/commandInstaller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"commandInstaller.d.ts","sourceRoot":"","sources":["../../src/commands/commandInstaller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,mGAAmG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AmF;AACnF,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,GAAE,mBAAwB,GAAG,IAAI,CAGpG;AAED,kFAAkF;AAClF,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,MAAiB,EAAE,IAAI,GAAE,mBAAwB,GAAG,IAAI,CAElG;AAQD,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAerE;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0BvE"}
|
|
@@ -3,8 +3,61 @@ import * as os from 'node:os';
|
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { success, dim } from '../output/styles.js';
|
|
6
|
+
import { normalizeTarget, invalidTargetMessage } from './ideTargets.js';
|
|
7
|
+
import { UserError } from '../utils/errors.js';
|
|
6
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
9
|
const __dirname = path.dirname(__filename);
|
|
10
|
+
/**
|
|
11
|
+
* One entry per deliverable target — the `Record<CommandTarget, …>` annotation
|
|
12
|
+
* makes the compiler reject a CommandTarget without a descriptor.
|
|
13
|
+
*/
|
|
14
|
+
export const COMMAND_TARGETS = {
|
|
15
|
+
claude: {
|
|
16
|
+
sourceDir: 'cf',
|
|
17
|
+
localDir: '.claude/commands',
|
|
18
|
+
globalDir: () => path.join(os.homedir(), '.claude', 'commands'),
|
|
19
|
+
layout: 'flat-md',
|
|
20
|
+
invocationHint: (entry) => '/cf:' + entry.replace(/\.md$/, ''),
|
|
21
|
+
noun: 'commands',
|
|
22
|
+
label: 'Claude Code',
|
|
23
|
+
},
|
|
24
|
+
agents: {
|
|
25
|
+
sourceDir: 'codex',
|
|
26
|
+
localDir: '.agents/skills',
|
|
27
|
+
// Codex's machine-level skills directory (design D2 — live-verified before merge).
|
|
28
|
+
globalDir: () => path.join(os.homedir(), '.codex', 'skills'),
|
|
29
|
+
layout: 'skill-dirs',
|
|
30
|
+
invocationHint: (entry) => '$' + entry,
|
|
31
|
+
noun: 'skills',
|
|
32
|
+
label: 'Codex',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
function isCommandTarget(target) {
|
|
36
|
+
return target in COMMAND_TARGETS;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolve user input ('claude', 'codex', 'openai', 'agents', …) to a deliverable
|
|
40
|
+
* command target. Throws UserError for unknown targets and for valid IDE targets
|
|
41
|
+
* with no command delivery (copilot, cursor) — an explicit error, not a no-op.
|
|
42
|
+
*/
|
|
43
|
+
export function resolveCommandTarget(input) {
|
|
44
|
+
const normalized = normalizeTarget(input);
|
|
45
|
+
if (!normalized) {
|
|
46
|
+
throw new UserError(invalidTargetMessage(input));
|
|
47
|
+
}
|
|
48
|
+
if (!isCommandTarget(normalized)) {
|
|
49
|
+
throw new UserError(`No command delivery exists for target '${normalized}'. ` +
|
|
50
|
+
`Commands are available for: ${Object.keys(COMMAND_TARGETS).join(', ')} (aliases: codex, openai → agents).`);
|
|
51
|
+
}
|
|
52
|
+
return normalized;
|
|
53
|
+
}
|
|
54
|
+
/** Resolve the install directory for a target and scope. Project-local is the default. */
|
|
55
|
+
export function resolveInstallDir(target, opts = {}) {
|
|
56
|
+
if (opts.targetDir)
|
|
57
|
+
return path.resolve(opts.targetDir);
|
|
58
|
+
const descriptor = COMMAND_TARGETS[target];
|
|
59
|
+
return opts.global ? descriptor.globalDir() : path.resolve(process.cwd(), descriptor.localDir);
|
|
60
|
+
}
|
|
8
61
|
/** Resolve the bundled commands/ directory relative to this script's location. */
|
|
9
62
|
export function getSourceCommandsDir() {
|
|
10
63
|
// In dist: dist/commands/commandInstaller.js → ../../commands/
|
|
@@ -15,23 +68,14 @@ export function getSourceCommandsDir() {
|
|
|
15
68
|
}
|
|
16
69
|
return resolved;
|
|
17
70
|
}
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
* Creates directories as needed. Overwrites existing files (idempotent).
|
|
21
|
-
* Removes stale .md files in the target that no longer exist in the source.
|
|
22
|
-
*
|
|
23
|
-
* @returns Object with installed and removed filenames.
|
|
24
|
-
*/
|
|
25
|
-
export function installCommands(targetDir) {
|
|
26
|
-
const sourceDir = path.join(getSourceCommandsDir(), 'cf');
|
|
71
|
+
/** flat-md layout: copy cf/*.md into targetDir/cf/, prune stale managed .md files. */
|
|
72
|
+
function installFlatMd(sourceDir, targetDir) {
|
|
27
73
|
const targetCfDir = path.join(targetDir, 'cf');
|
|
28
74
|
fs.mkdirSync(targetCfDir, { recursive: true });
|
|
29
75
|
const sourceFiles = new Set(fs.readdirSync(sourceDir).filter((f) => f.endsWith('.md')));
|
|
30
|
-
// Install current files
|
|
31
76
|
for (const file of sourceFiles) {
|
|
32
77
|
fs.copyFileSync(path.join(sourceDir, file), path.join(targetCfDir, file));
|
|
33
78
|
}
|
|
34
|
-
// Remove stale files (exist in target but not in source)
|
|
35
79
|
const removed = [];
|
|
36
80
|
const targetFiles = fs.readdirSync(targetCfDir).filter((f) => f.endsWith('.md'));
|
|
37
81
|
for (const file of targetFiles) {
|
|
@@ -42,66 +86,118 @@ export function installCommands(targetDir) {
|
|
|
42
86
|
}
|
|
43
87
|
return { installed: [...sourceFiles], removed };
|
|
44
88
|
}
|
|
89
|
+
/** Names of bundled skill directories (subdirectories containing a SKILL.md). */
|
|
90
|
+
function bundledSkillNames(sourceDir) {
|
|
91
|
+
return fs
|
|
92
|
+
.readdirSync(sourceDir, { withFileTypes: true })
|
|
93
|
+
.filter((e) => e.isDirectory() && fs.existsSync(path.join(sourceDir, e.name, 'SKILL.md')))
|
|
94
|
+
.map((e) => e.name);
|
|
95
|
+
}
|
|
45
96
|
/**
|
|
46
|
-
*
|
|
47
|
-
* "Managed" =
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
97
|
+
* skill-dirs layout: copy each bundled skill directory into targetDir, then prune
|
|
98
|
+
* stale managed directories. "Managed" = `cf-` prefix AND contains a SKILL.md —
|
|
99
|
+
* the prefix marks CF ownership (the analogue of the cf/ subdirectory in the flat
|
|
100
|
+
* layout); the SKILL.md check keeps non-skill directories that merely share the
|
|
101
|
+
* prefix untouched. Other skills in the directory (e.g. the guide's workflow
|
|
102
|
+
* skills) are never touched.
|
|
52
103
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
const
|
|
104
|
+
function installSkillDirs(sourceDir, targetDir) {
|
|
105
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
106
|
+
const sourceSkills = new Set(bundledSkillNames(sourceDir));
|
|
107
|
+
for (const skill of sourceSkills) {
|
|
108
|
+
fs.cpSync(path.join(sourceDir, skill), path.join(targetDir, skill), { recursive: true });
|
|
109
|
+
}
|
|
57
110
|
const removed = [];
|
|
58
|
-
for (const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
111
|
+
for (const entry of fs.readdirSync(targetDir, { withFileTypes: true })) {
|
|
112
|
+
if (!entry.isDirectory() || !entry.name.startsWith('cf-') || sourceSkills.has(entry.name))
|
|
113
|
+
continue;
|
|
114
|
+
if (!fs.existsSync(path.join(targetDir, entry.name, 'SKILL.md')))
|
|
115
|
+
continue;
|
|
116
|
+
fs.rmSync(path.join(targetDir, entry.name), { recursive: true });
|
|
117
|
+
removed.push(entry.name);
|
|
64
118
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
119
|
+
return { installed: [...sourceSkills], removed };
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Install a target's bundled command assets into targetDir (layout per descriptor).
|
|
123
|
+
* Creates directories as needed, overwrites existing files (idempotent), and
|
|
124
|
+
* removes stale managed entries no longer present in the source.
|
|
125
|
+
*/
|
|
126
|
+
export function installCommands(target, targetDir) {
|
|
127
|
+
const descriptor = COMMAND_TARGETS[target];
|
|
128
|
+
const sourceDir = path.join(getSourceCommandsDir(), descriptor.sourceDir);
|
|
129
|
+
return descriptor.layout === 'flat-md'
|
|
130
|
+
? installFlatMd(sourceDir, targetDir)
|
|
131
|
+
: installSkillDirs(sourceDir, targetDir);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Remove managed command assets from the target.
|
|
135
|
+
* "Managed" = entries present in the bundled source for this target.
|
|
136
|
+
* Preserves user-added entries. flat-md removes cf/ if left empty; skill-dirs
|
|
137
|
+
* never removes the parent directory (it is shared with other skills).
|
|
138
|
+
* Idempotent — no error if files or directories don't exist.
|
|
139
|
+
*/
|
|
140
|
+
export function uninstallCommands(target, targetDir) {
|
|
141
|
+
const descriptor = COMMAND_TARGETS[target];
|
|
142
|
+
const sourceDir = path.join(getSourceCommandsDir(), descriptor.sourceDir);
|
|
143
|
+
const removed = [];
|
|
144
|
+
if (descriptor.layout === 'flat-md') {
|
|
145
|
+
const managedFiles = fs.readdirSync(sourceDir).filter((f) => f.endsWith('.md'));
|
|
146
|
+
const targetCfDir = path.join(targetDir, 'cf');
|
|
147
|
+
for (const file of managedFiles) {
|
|
148
|
+
const filePath = path.join(targetCfDir, file);
|
|
149
|
+
if (fs.existsSync(filePath)) {
|
|
150
|
+
fs.rmSync(filePath);
|
|
151
|
+
removed.push(file);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (fs.existsSync(targetCfDir) && fs.readdirSync(targetCfDir).length === 0) {
|
|
69
155
|
fs.rmdirSync(targetCfDir);
|
|
70
156
|
}
|
|
71
157
|
}
|
|
158
|
+
else {
|
|
159
|
+
for (const skill of bundledSkillNames(sourceDir)) {
|
|
160
|
+
const skillDir = path.join(targetDir, skill);
|
|
161
|
+
if (fs.existsSync(skillDir)) {
|
|
162
|
+
fs.rmSync(skillDir, { recursive: true });
|
|
163
|
+
removed.push(skill);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
72
167
|
return removed;
|
|
73
168
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const target = targetDir ?? defaultTarget();
|
|
81
|
-
const { installed, removed } = installCommands(target);
|
|
82
|
-
console.log(success(`Installed ${installed.length} commands to ${target}/cf/`));
|
|
83
|
-
for (const file of installed) {
|
|
84
|
-
console.log(` ${dim('/cf:' + file.replace('.md', ''))}`);
|
|
169
|
+
function reportInstall(target, dir, result) {
|
|
170
|
+
const descriptor = COMMAND_TARGETS[target];
|
|
171
|
+
const installedDir = descriptor.layout === 'flat-md' ? path.join(dir, 'cf') : dir;
|
|
172
|
+
console.log(success(`Installed ${result.installed.length} ${descriptor.noun} to ${installedDir} (${descriptor.label})`));
|
|
173
|
+
for (const entry of result.installed) {
|
|
174
|
+
console.log(` ${dim(descriptor.invocationHint(entry))}`);
|
|
85
175
|
}
|
|
86
|
-
if (removed.length > 0) {
|
|
87
|
-
console.log(dim(`Removed ${removed.length} stale
|
|
176
|
+
if (result.removed.length > 0) {
|
|
177
|
+
console.log(dim(`Removed ${result.removed.length} stale ${descriptor.noun}: ${result.removed
|
|
178
|
+
.map((e) => descriptor.invocationHint(e))
|
|
179
|
+
.join(', ')}`));
|
|
88
180
|
}
|
|
89
181
|
}
|
|
182
|
+
/** Install and report for an already-resolved command target. Errors propagate. */
|
|
183
|
+
export function installCommandsForTarget(target, opts = {}) {
|
|
184
|
+
const dir = resolveInstallDir(target, opts);
|
|
185
|
+
reportInstall(target, dir, installCommands(target, dir));
|
|
186
|
+
}
|
|
187
|
+
/** Install and report, resolving the target from user input. Errors propagate. */
|
|
188
|
+
export function installCommandsAction(ide = 'claude', opts = {}) {
|
|
189
|
+
installCommandsForTarget(resolveCommandTarget(ide), opts);
|
|
190
|
+
}
|
|
90
191
|
export function registerInstallCommandsCommand(program) {
|
|
91
192
|
program
|
|
92
193
|
.command('install-commands')
|
|
93
|
-
.description('Install
|
|
94
|
-
.option('--
|
|
194
|
+
.description('Install Context Forge slash commands (Claude Code) or agent skills (Codex)')
|
|
195
|
+
.option('--ide <target>', 'IDE target: claude, agents (aliases: openai, codex)', 'claude')
|
|
196
|
+
.option('--global', 'Install to the machine-level directory instead of project-local')
|
|
197
|
+
.option('--target <dir>', 'Explicit target directory (overrides --ide/--global resolution)')
|
|
95
198
|
.action((opts) => {
|
|
96
199
|
try {
|
|
97
|
-
|
|
98
|
-
console.log(success(`Installed ${installed.length} commands to ${opts.target}/cf/`));
|
|
99
|
-
for (const file of installed) {
|
|
100
|
-
console.log(` ${dim('/cf:' + file.replace('.md', ''))}`);
|
|
101
|
-
}
|
|
102
|
-
if (removed.length > 0) {
|
|
103
|
-
console.log(dim(`Removed ${removed.length} stale command(s): ${removed.map((f) => f.replace('.md', '')).join(', ')}`));
|
|
104
|
-
}
|
|
200
|
+
installCommandsAction(opts.ide, { global: opts.global, targetDir: opts.target });
|
|
105
201
|
}
|
|
106
202
|
catch (err) {
|
|
107
203
|
console.error(`Error: ${err.message}`);
|
|
@@ -112,18 +208,23 @@ export function registerInstallCommandsCommand(program) {
|
|
|
112
208
|
export function registerUninstallCommandsCommand(program) {
|
|
113
209
|
program
|
|
114
210
|
.command('uninstall-commands')
|
|
115
|
-
.description('Remove
|
|
116
|
-
.option('--
|
|
211
|
+
.description('Remove Context Forge slash commands (Claude Code) or agent skills (Codex)')
|
|
212
|
+
.option('--ide <target>', 'IDE target: claude, agents (aliases: openai, codex)', 'claude')
|
|
213
|
+
.option('--global', 'Uninstall from the machine-level directory instead of project-local')
|
|
214
|
+
.option('--target <dir>', 'Explicit target directory (overrides --ide/--global resolution)')
|
|
117
215
|
.action((opts) => {
|
|
118
216
|
try {
|
|
119
|
-
const
|
|
217
|
+
const target = resolveCommandTarget(opts.ide);
|
|
218
|
+
const descriptor = COMMAND_TARGETS[target];
|
|
219
|
+
const dir = resolveInstallDir(target, { global: opts.global, targetDir: opts.target });
|
|
220
|
+
const removed = uninstallCommands(target, dir);
|
|
120
221
|
if (removed.length === 0) {
|
|
121
|
-
console.log(dim(
|
|
222
|
+
console.log(dim(`No ${descriptor.noun} found to remove.`));
|
|
122
223
|
}
|
|
123
224
|
else {
|
|
124
|
-
console.log(success(`Removed ${removed.length}
|
|
125
|
-
for (const
|
|
126
|
-
console.log(` ${dim(
|
|
225
|
+
console.log(success(`Removed ${removed.length} ${descriptor.noun} from ${dir}`));
|
|
226
|
+
for (const entry of removed) {
|
|
227
|
+
console.log(` ${dim(descriptor.invocationHint(entry))}`);
|
|
127
228
|
}
|
|
128
229
|
}
|
|
129
230
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandInstaller.js","sourceRoot":"","sources":["../../src/commands/commandInstaller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"commandInstaller.js","sourceRoot":"","sources":["../../src/commands/commandInstaller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAe,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,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OAAO,EAAE,CAAC;oBAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,UAAW,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;YAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared IDE-target vocabulary. Both setup-ide (IDE file generation) and
|
|
3
|
+
* commandInstaller (command/skill delivery) resolve user input through this
|
|
4
|
+
* single alias table so a target string means the same thing everywhere.
|
|
5
|
+
* Lives in its own module to keep setup-ide ⇄ commandInstaller acyclic.
|
|
6
|
+
*/
|
|
7
|
+
export type Target = 'claude' | 'copilot' | 'cursor' | 'agents';
|
|
8
|
+
/** Canonical target names — the single source for validation and help text. */
|
|
9
|
+
export declare const TARGET_NAMES: readonly Target[];
|
|
10
|
+
/** Aliases resolved to a canonical target before anything downstream sees the input. */
|
|
11
|
+
export declare const TARGET_ALIASES: Record<string, Target>;
|
|
12
|
+
/** Resolves a target string (case/whitespace-insensitive) to its canonical form, or null if unknown. */
|
|
13
|
+
export declare function normalizeTarget(input: string): Target | null;
|
|
14
|
+
/** Built from TARGET_NAMES/TARGET_ALIASES so the message can never drift from what normalizeTarget accepts. */
|
|
15
|
+
export declare function invalidTargetMessage(input: string): string;
|
|
16
|
+
//# sourceMappingURL=ideTargets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ideTargets.d.ts","sourceRoot":"","sources":["../../src/commands/ideTargets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEhE,+EAA+E;AAC/E,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAA8C,CAAC;AAEzF,wFAAwF;AACxF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAyC,CAAC;AAE5F,wGAAwG;AACxG,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK5D;AAeD,+GAA+G;AAC/G,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared IDE-target vocabulary. Both setup-ide (IDE file generation) and
|
|
3
|
+
* commandInstaller (command/skill delivery) resolve user input through this
|
|
4
|
+
* single alias table so a target string means the same thing everywhere.
|
|
5
|
+
* Lives in its own module to keep setup-ide ⇄ commandInstaller acyclic.
|
|
6
|
+
*/
|
|
7
|
+
/** Canonical target names — the single source for validation and help text. */
|
|
8
|
+
export const TARGET_NAMES = ['claude', 'copilot', 'cursor', 'agents'];
|
|
9
|
+
/** Aliases resolved to a canonical target before anything downstream sees the input. */
|
|
10
|
+
export const TARGET_ALIASES = { openai: 'agents', codex: 'agents' };
|
|
11
|
+
/** Resolves a target string (case/whitespace-insensitive) to its canonical form, or null if unknown. */
|
|
12
|
+
export function normalizeTarget(input) {
|
|
13
|
+
const normalized = input.trim().toLowerCase();
|
|
14
|
+
if (TARGET_NAMES.includes(normalized))
|
|
15
|
+
return normalized;
|
|
16
|
+
if (normalized in TARGET_ALIASES)
|
|
17
|
+
return TARGET_ALIASES[normalized];
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
/** Groups TARGET_ALIASES by canonical target, e.g. "openai, codex → agents". */
|
|
21
|
+
function describeAliases() {
|
|
22
|
+
const byTarget = new Map();
|
|
23
|
+
for (const [alias, target] of Object.entries(TARGET_ALIASES)) {
|
|
24
|
+
const group = byTarget.get(target) ?? [];
|
|
25
|
+
group.push(alias);
|
|
26
|
+
byTarget.set(target, group);
|
|
27
|
+
}
|
|
28
|
+
return Array.from(byTarget.entries())
|
|
29
|
+
.map(([target, aliases]) => `${aliases.join(', ')} → ${target}`)
|
|
30
|
+
.join(', ');
|
|
31
|
+
}
|
|
32
|
+
/** Built from TARGET_NAMES/TARGET_ALIASES so the message can never drift from what normalizeTarget accepts. */
|
|
33
|
+
export function invalidTargetMessage(input) {
|
|
34
|
+
return `Invalid target '${input}'. Valid targets: ${TARGET_NAMES.join(', ')} (aliases: ${describeAliases()})`;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=ideTargets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ideTargets.js","sourceRoot":"","sources":["../../src/commands/ideTargets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,YAAY,GAAsB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEzF,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAA2B,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAE5F,wGAAwG;AACxG,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,IAAK,YAAkC,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,UAAoB,CAAC;IAC1F,IAAI,UAAU,IAAI,cAAc;QAAE,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,gFAAgF;AAChF,SAAS,eAAe;IACtB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC7C,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACzC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,MAAM,EAAE,CAAC;SAC/D,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,mBAAmB,KAAK,qBAAqB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,eAAe,EAAE,GAAG,CAAC;AAChH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4DpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4DpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0G1D"}
|
package/dist/commands/init.js
CHANGED
|
@@ -117,13 +117,23 @@ export function registerInitCommand(program) {
|
|
|
117
117
|
console.log(warn(`Guides install failed: ${msg}`));
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
// Step 3: Install commands
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
// Step 3: Install commands/skills for the chosen IDE target, machine-level
|
|
121
|
+
// (preserves the pre-slice-924 behavior of a global Claude install; a
|
|
122
|
+
// project-local install is available via `cf install-commands` directly).
|
|
123
|
+
// --no-ide skips delivery entirely; targets without command delivery
|
|
124
|
+
// (copilot, cursor) and invalid targets skip silently here — Step 4
|
|
125
|
+
// reports invalid targets with the full message.
|
|
126
|
+
if (opts.ide !== false) {
|
|
127
|
+
const ideTarget = typeof opts.ide === 'string' ? opts.ide : 'claude';
|
|
128
|
+
const normalizedIde = normalizeTarget(ideTarget);
|
|
129
|
+
if (normalizedIde === 'claude' || normalizedIde === 'agents') {
|
|
130
|
+
try {
|
|
131
|
+
installCommandsAction(normalizedIde, { global: true });
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
console.log(warn(`Command install failed: ${err.message}`));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
127
137
|
}
|
|
128
138
|
// Step 4: IDE setup (--no-ide sets opts.ide to false via commander negation)
|
|
129
139
|
if (opts.ide !== false) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAA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EAAmE,CAAC,CAAC;QACnF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import type { ProjectData } from '@context-forge/core';
|
|
3
|
-
|
|
3
|
+
import { type Target } from './ideTargets.js';
|
|
4
|
+
export { normalizeTarget, invalidTargetMessage, TARGET_ALIASES, type Target } from './ideTargets.js';
|
|
4
5
|
export interface TargetDescriptor {
|
|
5
6
|
/** Files probed for the managed marker; also the files backed up before overwrite. */
|
|
6
7
|
markerFiles: string[];
|
|
@@ -15,12 +16,6 @@ export interface TargetDescriptor {
|
|
|
15
16
|
* the compiler reject a target added to the `Target` union without an entry here.
|
|
16
17
|
*/
|
|
17
18
|
export declare const TARGETS: Record<Target, TargetDescriptor>;
|
|
18
|
-
/** Aliases resolved to a canonical target before anything downstream sees the input. */
|
|
19
|
-
export declare const TARGET_ALIASES: Record<string, Target>;
|
|
20
|
-
/** Resolves a target string (case/whitespace-insensitive) to its canonical form, or null if unknown. */
|
|
21
|
-
export declare function normalizeTarget(input: string): Target | null;
|
|
22
|
-
/** Built from TARGETS/TARGET_ALIASES so the message can never drift from what normalizeTarget accepts. */
|
|
23
|
-
export declare function invalidTargetMessage(input: string): string;
|
|
24
19
|
export declare const MANAGED_MARKER = "[//]: # (context-forge:managed)";
|
|
25
20
|
/**
|
|
26
21
|
* Returns true if any of the given (root-relative, `/`-separated) files exists
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-ide.d.ts","sourceRoot":"","sources":["../../src/commands/setup-ide.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD,
|
|
1
|
+
{"version":3,"file":"setup-ide.d.ts","sourceRoot":"","sources":["../../src/commands/setup-ide.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD,OAAO,EAAyC,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIrF,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAErG,MAAM,WAAW,gBAAgB;IAC/B,sFAAsF;IACtF,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,oDAAoD;IACpD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAqBpD,CAAC;AAaF,eAAO,MAAM,cAAc,oCAAoC,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAYpF;AAED,mEAAmE;AACnE,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GACvB,OAAO,CAAC,IAAI,CAAC,CAwEf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAyC/E;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6C9D"}
|
|
@@ -6,6 +6,10 @@ import { FileProjectStore, GuideDetector, GUIDE_RELATIVE_PATH } from '@context-f
|
|
|
6
6
|
import { resolveProjectId } from '../utils/project.js';
|
|
7
7
|
import { withProjectOption, withYesOption } from '../options.js';
|
|
8
8
|
import { handleError, UserError } from '../utils/errors.js';
|
|
9
|
+
import { normalizeTarget, invalidTargetMessage } from './ideTargets.js';
|
|
10
|
+
import { installCommandsForTarget } from './commandInstaller.js';
|
|
11
|
+
// Re-exported so existing importers (tests, init.ts) keep one import site.
|
|
12
|
+
export { normalizeTarget, invalidTargetMessage, TARGET_ALIASES } from './ideTargets.js';
|
|
9
13
|
/**
|
|
10
14
|
* One definition per target drives validation, the managed-marker check, backup,
|
|
11
15
|
* and worktree propagation. The `Record<Target, TargetDescriptor>` annotation makes
|
|
@@ -33,33 +37,6 @@ export const TARGETS = {
|
|
|
33
37
|
label: 'agents',
|
|
34
38
|
},
|
|
35
39
|
};
|
|
36
|
-
/** Aliases resolved to a canonical target before anything downstream sees the input. */
|
|
37
|
-
export const TARGET_ALIASES = { openai: 'agents', codex: 'agents' };
|
|
38
|
-
/** Resolves a target string (case/whitespace-insensitive) to its canonical form, or null if unknown. */
|
|
39
|
-
export function normalizeTarget(input) {
|
|
40
|
-
const normalized = input.trim().toLowerCase();
|
|
41
|
-
if (normalized in TARGETS)
|
|
42
|
-
return normalized;
|
|
43
|
-
if (normalized in TARGET_ALIASES)
|
|
44
|
-
return TARGET_ALIASES[normalized];
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
/** Groups TARGET_ALIASES by canonical target, e.g. "openai, codex → agents". */
|
|
48
|
-
function describeAliases() {
|
|
49
|
-
const byTarget = new Map();
|
|
50
|
-
for (const [alias, target] of Object.entries(TARGET_ALIASES)) {
|
|
51
|
-
const group = byTarget.get(target) ?? [];
|
|
52
|
-
group.push(alias);
|
|
53
|
-
byTarget.set(target, group);
|
|
54
|
-
}
|
|
55
|
-
return Array.from(byTarget.entries())
|
|
56
|
-
.map(([target, aliases]) => `${aliases.join(', ')} → ${target}`)
|
|
57
|
-
.join(', ');
|
|
58
|
-
}
|
|
59
|
-
/** Built from TARGETS/TARGET_ALIASES so the message can never drift from what normalizeTarget accepts. */
|
|
60
|
-
export function invalidTargetMessage(input) {
|
|
61
|
-
return `Invalid target '${input}'. Valid targets: ${Object.keys(TARGETS).join(', ')} (aliases: ${describeAliases()})`;
|
|
62
|
-
}
|
|
63
40
|
/** Prompt user for y/N confirmation via stdin. Returns true if confirmed. */
|
|
64
41
|
function askConfirmation(prompt) {
|
|
65
42
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -229,6 +206,12 @@ export function registerSetupIdeCommand(program) {
|
|
|
229
206
|
}
|
|
230
207
|
await setupIdeAction(project.projectPath, normalizedTarget, { yes: opts.yes });
|
|
231
208
|
propagateToWorktrees(project, normalizedTarget);
|
|
209
|
+
// Command/skill delivery: setup-ide is a machine-level operation, so it
|
|
210
|
+
// installs to the global directory (design D5). Targets without command
|
|
211
|
+
// delivery (copilot, cursor) skip this step silently.
|
|
212
|
+
if (normalizedTarget === 'claude' || normalizedTarget === 'agents') {
|
|
213
|
+
installCommandsForTarget(normalizedTarget, { global: true });
|
|
214
|
+
}
|
|
232
215
|
}
|
|
233
216
|
catch (err) {
|
|
234
217
|
handleError(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-ide.js","sourceRoot":"","sources":["../../src/commands/setup-ide.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBA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EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;YAC/E,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;YAEhD,wEAAwE;YACxE,wEAAwE;YACxE,sDAAsD;YACtD,IAAI,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,KAAK,QAAQ,EAAE,CAAC;gBACnE,wBAAwB,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@context-forge/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "CLI for Context Forge — terminal access to context assembly, project management, workflow navigation, and configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"chalk": "^5.4.1",
|
|
34
34
|
"commander": "^13.1.0",
|
|
35
|
-
"@context-forge/core": "0.
|
|
35
|
+
"@context-forge/core": "0.13.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^25.3.0",
|