Skip to content

Commit b602900

Browse files
committed
feat: Add integration for raycast extension
1 parent 833bb04 commit b602900

7 files changed

Lines changed: 671 additions & 48 deletions

File tree

Documentation/ExtensionAPI.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@ name. `delete` and `erase` require at least one workspace name and `--yes`.
9595
`open` and `workspace paths` without a name use the current workspace. Every
9696
integration attribute command requires an explicit integration identifier, and
9797
`set` also requires an explicit value. `integrations raycast install` requires
98-
an explicit `app` or `script-command` component. Script Command installation
99-
also requires `--directory` unless an installed configuration already records
100-
the directory.
98+
an explicit `app`, `extension`, or `script-command` component. Script Command
99+
installation also requires `--directory` unless an installed configuration
100+
already records the directory; this component is deprecated in favor of the
101+
extension. Extension installation requires `--yes` when Raycast is absent, or
102+
`--open-in-browser` to bypass Raycast installation.
101103

102104
## Stable workspace identities
103105

@@ -117,7 +119,7 @@ fxcodex open \
117119
```
118120

119121
The ID and workspace name are mutually exclusive for `open`. Other workspace
120-
mutation commands continue to accept names in 0.2.1.
122+
mutation commands continue to accept names in 0.3.0.
121123

122124
`workspace paths` also accepts either a workspace name or `--workspace-id`.
123125
Its response identifies the selected workspace and includes
@@ -172,14 +174,17 @@ resulting component status:
172174

173175
```sh
174176
fxcodex integrations raycast install app --json
177+
fxcodex integrations raycast install extension --open-in-browser --json
175178
fxcodex integrations raycast install script-command \
176179
--directory "$HOME/.config/raycast/script-commands" \
177180
--json
178181
```
179182

180183
Application outcomes are `already-installed`, `installed`, or
181-
`download-opened`. Script Command installation returns `installed` together
182-
with `script_commands`.
184+
`download-opened`. Extension installation returns `extension-opened` when its
185+
Raycast deep link is opened or `store-page-opened` when the browser is used.
186+
Script Command installation returns `installed` together with
187+
`script_commands`.
183188

184189
`rename` requests the `Codex.app` name and returns a
185190
`CodexApplicationRenameResult`. `rename --undo` requests `ChatGPT.app`. The
@@ -214,13 +219,13 @@ Set a scoped environment variable to `-1` to exclude that section even when
214219
all sections are enabled. On the command line, use the corresponding
215220
`--no-list-...` flag.
216221

217-
The following commands are intentionally outside the 0.2.1 machine API:
222+
The following commands are intentionally outside the 0.3.0 machine API:
218223

219224
- `cli` and `exec` replace the fxcodex process with Codex CLI, whose session or
220225
output may be interactive.
221226
- The root `uninstall` command removes the current executable.
222227
- `integrations raycast sync` and `integrations raycast uninstall` are
223-
terminal-only maintenance commands in 0.2.1.
228+
terminal-only maintenance commands in 0.3.0.
224229

225230
A frontend should use the supported workspace and status commands and refresh
226231
its state after mutations. Raycast Script Commands remain an optional

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,22 @@ otherwise, `set` stores the input as a string.
315315

316316
## Raycast integration
317317

318+
Run either command without a trailing action to choose interactively:
319+
320+
```sh
321+
fxcodex integrations
322+
fxcodex integrations raycast
323+
```
324+
325+
The Raycast menu offers status and installation actions. Installation then
326+
offers Raycast, Raycast Beta, the fxcodex extension, and the deprecated Script
327+
Commands integration.
328+
318329
### Script Commands
319330

320-
`fxcodex` can install and maintain Raycast Script Commands for quickly opening
321-
workspaces. Start the guided setup with:
331+
Raycast Script Commands are deprecated in favor of the extension, but `fxcodex`
332+
continues to install and maintain them for quickly opening workspaces. Choose a
333+
component interactively with:
322334

323335
```sh
324336
fxcodex integrations raycast install
@@ -345,9 +357,17 @@ later-selected workspaces are not added automatically. Reinstall without
345357
### Extension
346358

347359
A companion Raycast extension provides workspace navigation, management,
348-
custom icons, executable selection, and preferences. It is prepared separately
349-
for [Raycast Store submission](https://github.com/raycast/extensions/pull/29538); the Script Commands
350-
above are available without it.
360+
custom icons, executable selection, and preferences. Install it with:
361+
362+
```sh
363+
fxcodex integrations raycast install extension
364+
```
365+
366+
When both Raycast and Raycast Beta are installed, `fxcodex` asks which edition
367+
should open the extension deep link. When neither is installed, the guided flow
368+
recommends installing Raycast before offering the browser as a fallback. Use
369+
`--open-in-browser` to open the [fxcodex Raycast Store page](https://www.raycast.com/maximkrouk/fxcodex)
370+
directly. The Script Commands above remain available without the extension.
351371

352372
## Machine-readable output
353373

Sources/fxcodex-cli/AppCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import FXCodexClient
66

77
@main
88
internal struct AppCommand: AsyncParsableCommand {
9-
internal static let version: String = "0.2.1"
9+
internal static let version: String = "0.3.0"
1010
internal static let machineEncodingFailureResponse: String = """
1111
{
1212
"api_version": 1,

Sources/fxcodex-cli/Commands/Integrations/IntegrationCommand.swift

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,20 @@ extension AppCommand {
2828
"Choose an integration area:",
2929
[
3030
.init(value: "attributes", label: "Attributes", hint: "Read or modify integration data"),
31-
.init(value: "raycast", label: "Raycast", hint: "Show Raycast integration status"),
31+
.init(value: "raycast", label: "Raycast", hint: "Manage Raycast integration components"),
3232
]
3333
)
3434
else { return }
3535

3636
switch area {
3737
case "attributes":
38-
try await Attributes().run()
38+
let command: Attributes = try .parse([])
39+
try await command.run()
40+
3941
case "raycast":
40-
try await Raycast.Status().run()
42+
let command: Raycast = try .parse([])
43+
try await command.run()
44+
4145
default:
4246
throw ValidationError("Unsupported integration area.")
4347
}
@@ -319,9 +323,39 @@ extension AppCommand.IntegrationsCommand {
319323
Sync.self,
320324
Uninstall.self,
321325
],
322-
defaultSubcommand: Status.self
326+
defaultSubcommand: nil
323327
)
324328

325329
internal init() {}
330+
331+
internal func run() async throws {
332+
guard !globalMachineOutputRequested() else {
333+
throw ValidationError("Choose status or install when using --json.")
334+
}
335+
336+
@Dependency(\._fxcodexTerminalPrompts)
337+
var prompts: TerminalPromptsClient
338+
339+
guard let action = try prompts.select(
340+
"Choose a Raycast action:",
341+
[
342+
.init(value: "status", label: "Status", hint: "Show installed components"),
343+
.init(value: "install", label: "Install", hint: "Install a component"),
344+
]
345+
) else { return }
346+
347+
switch action {
348+
case "status":
349+
let command: Status = try .parse([])
350+
try await command.run()
351+
352+
case "install":
353+
let command: Install = try .parse([])
354+
try await command.run()
355+
356+
default:
357+
throw ValidationError("Unsupported Raycast action.")
358+
}
359+
}
326360
}
327361
}

0 commit comments

Comments
 (0)