@cirtium/acent-connect 0.2.2 → 0.2.4
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/README.md +29 -12
- package/acent/.claude-plugin/plugin.json +1 -1
- package/acent/.codex-plugin/plugin.json +1 -1
- package/acent/.cursor-plugin/plugin.json +1 -1
- package/acent/README.md +1 -1
- package/acent/mcp-codex.json +1 -4
- package/acent/scripts/host-guidance.mjs +18 -0
- package/acent/scripts/mcp-proxy.mjs +2 -1
- package/acent/skills/acent-connect/SKILL.md +11 -0
- package/antigravity/README.md +1 -1
- package/antigravity/plugin.json +1 -1
- package/package.json +10 -2
- package/scripts/acent.mjs +22 -52
- package/scripts/choose-tool.mjs +82 -0
- package/scripts/install-plugin.mjs +67 -13
- package/scripts/local-registration.mjs +49 -0
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Connect your coding tool to Acent to retrieve project context and optionally save
|
|
4
4
|
new conversations. Requires Node.js 22 or later (with npm and npx) and your coding
|
|
5
|
-
tool
|
|
5
|
+
tool with local plugin support. The installer writes plugin files and supported
|
|
6
|
+
settings directly; it does not require the tool’s command-line launcher.
|
|
6
7
|
|
|
7
8
|
## 1. Install the plugin
|
|
8
9
|
|
|
@@ -13,8 +14,8 @@ npx @cirtium/acent-connect@latest install
|
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
If npm asks to download the package, confirm. Then choose Codex, Claude Code,
|
|
16
|
-
Cursor, or Antigravity
|
|
17
|
-
|
|
17
|
+
Cursor, or Antigravity with ↑/↓ and press Enter. The selected tool is highlighted;
|
|
18
|
+
Ctrl+C cancels without installing. Basic terminals also accept a number or name. The installer prepares the selected tool’s Acent plugin. No separate package download or global npm installation
|
|
18
19
|
is needed. Installation does not sign you in or authorize conversation saving.
|
|
19
20
|
|
|
20
21
|
To skip the tool-selection menu, specify your tool, for example:
|
|
@@ -26,12 +27,28 @@ npx @cirtium/acent-connect@latest install --tool codex
|
|
|
26
27
|
Tool values are `codex`, `claude`, `cursor`, and `antigravity`.
|
|
27
28
|
The plugin is installed for your tool, not copied into the current project folder.
|
|
28
29
|
|
|
30
|
+
To install Acent for all four supported tools, including tools you have not opened yet, run:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npx @cirtium/acent-connect@latest install --all
|
|
34
|
+
```
|
|
35
|
+
|
|
29
36
|
## 2. Connect in your agent
|
|
30
37
|
|
|
31
|
-
|
|
38
|
+
Follow the loading instructions for your selected tool:
|
|
39
|
+
|
|
40
|
+
| Tool | After installation |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| Codex | Restart and check Acent in Plugins. Install or enable the local entry if needed. Review and trust Acent’s hooks if you enable saving. |
|
|
43
|
+
| Claude Code | Start a new session or run `/reload-plugins`. Respond to workspace or tool permission prompts only if shown. |
|
|
44
|
+
| Cursor | Restart or run `Developer: Reload Window`, then check Customize. |
|
|
45
|
+
| Antigravity | Check Customizations → Installed. If Acent is not loaded in the current conversation, start a new one. Enabled hooks run automatically; no separate hook approval is prescribed. |
|
|
46
|
+
|
|
47
|
+
Open your project in the selected tool.
|
|
32
48
|
Send **“Connect Acent to this folder.”** in agent chat. Follow the returned link,
|
|
33
49
|
sign in to Acent, choose an Acent project, and review access and optional saving.
|
|
34
|
-
|
|
50
|
+
Connecting does not itself require another restart. Follow only pending host-specific
|
|
51
|
+
steps; connection success does not verify that a conversation has been saved.
|
|
35
52
|
|
|
36
53
|
No second terminal command is required. Each project folder has its own connection;
|
|
37
54
|
the plugin installation is shared across projects in the same tool.
|
|
@@ -67,8 +84,9 @@ npx @cirtium/acent-connect@latest update --tool codex
|
|
|
67
84
|
```
|
|
68
85
|
|
|
69
86
|
Updates preserve credentials, folder connections, and queued conversations.
|
|
70
|
-
For marketplace installs, use your tool's plugin updater. After updating,
|
|
71
|
-
|
|
87
|
+
For marketplace installs, use your tool's plugin updater. After updating, follow
|
|
88
|
+
the tool-specific loading instructions above. Codex may require review and trust
|
|
89
|
+
of changed hooks.
|
|
72
90
|
|
|
73
91
|
## Disconnect and remove
|
|
74
92
|
|
|
@@ -88,6 +106,7 @@ does not revoke server grants or delete saved Acent memories.
|
|
|
88
106
|
| Command or option | What it does |
|
|
89
107
|
| --- | --- |
|
|
90
108
|
| `install` | Installs the plugin. Connect afterward in your agent. |
|
|
109
|
+
| `install --all` | Prepares Acent for all four supported tools. |
|
|
91
110
|
| `connect` | Sets up the plugin and opens browser authorization for this folder. |
|
|
92
111
|
| `update` | Updates a CLI-managed plugin without changing its Acent connection. |
|
|
93
112
|
| `update --all` | Updates all plugins installed through the Acent CLI. |
|
|
@@ -95,16 +114,14 @@ does not revoke server grants or delete saved Acent memories.
|
|
|
95
114
|
| `flush` | Retries queued conversation saving for the selected tool and folder. |
|
|
96
115
|
| `--tool` | Selects `codex`, `claude`, `cursor`, or `antigravity` without a menu. |
|
|
97
116
|
| `--folder` | Uses a specified project folder instead of the current directory. |
|
|
98
|
-
| `--executable` |
|
|
117
|
+
| `--executable` | Legacy option; no longer needed for local installation. |
|
|
99
118
|
| `--help` | Shows commands and options without installing or connecting. |
|
|
100
119
|
|
|
101
120
|
Use these commands after `npx @cirtium/acent-connect@latest`, for example
|
|
102
121
|
`npx @cirtium/acent-connect@latest --help`.
|
|
103
122
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
reload and check Customize; a marketplace copy can take precedence over a local
|
|
107
|
-
plugin. These integrations do not automatically collect chats from the ordinary
|
|
123
|
+
Organization policies may restrict local plugins. In Cursor, reload and check
|
|
124
|
+
Customize; a marketplace copy can take precedence over a local plugin. These integrations do not automatically collect chats from the ordinary
|
|
108
125
|
ChatGPT, Claude, or Gemini apps.
|
|
109
126
|
|
|
110
127
|
[Setup guide](https://www.acent.cloud/docs/integrations) · [Website](https://www.acent.cloud) · [Privacy](https://www.acent.cloud/privacy) · [Terms](https://www.acent.cloud/terms)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "acent",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Open your project folder and ask \"Connect Acent\" in chat to sign in and choose an Acent project. Conversation saving is optional.",
|
|
5
5
|
"mcpServers": "./mcp-claude.json",
|
|
6
6
|
"hooks": "./hooks/claude.json"
|
package/acent/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Ask your agent to find relevant context in Acent, for example:
|
|
|
20
20
|
|
|
21
21
|
## Conversation saving
|
|
22
22
|
|
|
23
|
-
Saving
|
|
23
|
+
Saving requires consent on the Acent connection page and working plugin hooks. Codex additionally requires review and trust of those hooks. Other tools should follow their own loading guidance; a separate hook approval is not a universal step. Codex and Cursor save submitted prompts and completed assistant responses. Each project folder needs its own connection; connecting a general chat does not connect your other project folders.
|
|
24
24
|
|
|
25
25
|
Your agent can retrieve context from the approved project and account-wide memory. You can revoke the connection in Acent settings.
|
|
26
26
|
|
package/acent/mcp-codex.json
CHANGED
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
"mcpServers": {
|
|
3
3
|
"acent": {
|
|
4
4
|
"command": "node",
|
|
5
|
-
"args": [
|
|
6
|
-
"-e",
|
|
7
|
-
"const {execFileSync}=require('node:child_process');const {join,isAbsolute}=require('node:path');const {pathToFileURL}=require('node:url');try{const list=JSON.parse(execFileSync('codex',['plugin','list','--marketplace','acent','--json'],{encoding:'utf8',stdio:['ignore','pipe','pipe']}));const root=list.installed.find(p=>p.pluginId==='acent@acent'&&p.enabled)?.source?.path;if(!root||!isAbsolute(root))throw Error('Acent plugin source unavailable. Reinstall acent@acent.');process.argv=['node','acent-mcp','--tool','Codex'];import(pathToFileURL(join(root,'scripts/mcp-proxy.mjs')).href).catch(e=>{console.error(e.message);process.exitCode=1})}catch(e){console.error(e.message);process.exitCode=1}"
|
|
8
|
-
]
|
|
5
|
+
"args": ["${PLUGIN_ROOT}/scripts/mcp-proxy.mjs", "--tool", "Codex"]
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
8
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Installation prepares files; connection authorizes Acent. Neither proves hooks ran.
|
|
2
|
+
export function installationGuidance(tool) {
|
|
3
|
+
return {
|
|
4
|
+
Codex: "Restart Codex and check Acent in Plugins. If it is not enabled, install or enable the local Acent entry. Review and trust Acent's hooks to enable conversation saving. Then ask: Connect Acent.",
|
|
5
|
+
"Claude Code": "Start a new Claude Code session or run /reload-plugins, then ask: Connect Acent. Respond to workspace or tool permission prompts only if Claude Code shows them.",
|
|
6
|
+
Cursor: "Restart Cursor or run Developer: Reload Window, then check Acent in Customize and ask: Connect Acent. A marketplace copy can take precedence; organization policy can block local plugins.",
|
|
7
|
+
Antigravity: "Open Customizations > Installed and check that Acent is available and enabled, then ask: Connect Acent. If it has not loaded in the current conversation, start a new conversation. No separate hook approval step is prescribed.",
|
|
8
|
+
}[tool] || "Open your coding tool and check that Acent is available."
|
|
9
|
+
}
|
|
10
|
+
export function connectionGuidance(tool) {
|
|
11
|
+
const common = "Acent account authorization is complete. Refresh the available tools and continue in this session; do not request a restart solely because authorization completed. Connection does not prove that conversation saving has run."
|
|
12
|
+
return common + " " + ({
|
|
13
|
+
Codex: "If saving was enabled and hook trust is not yet confirmed, explain that Codex requires review and trust of Acent's hooks. Do not claim they are approved or repeat this if trust is already confirmed.",
|
|
14
|
+
"Claude Code": "Do not prescribe a separate hook approval. Mention workspace or tool permissions only if the host reports a pending request. Use /reload-plugins or a new session only for a confirmed plugin loading problem.",
|
|
15
|
+
Cursor: "Do not prescribe a separate hook approval or another reload after a successful connection. Explain a pending tool permission only when the host reports one.",
|
|
16
|
+
Antigravity: "Enabled plugin hooks run automatically. Do not ask for hook approval or a restart after connection. If components are missing, inspect plugin enablement before suggesting a new conversation.",
|
|
17
|
+
}[tool] || "Report only next steps supported by the host state.")
|
|
18
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { connectionGuidance } from "./host-guidance.mjs"
|
|
2
3
|
// Folder-scoped MCP with setup available even before the first authorization.
|
|
3
4
|
import { clarificationInstructions, clarificationTool, clarify, createQuestionChannel } from "./clarification.mjs"
|
|
4
5
|
import { connectionContext, createRootsChannel, projectFolder } from "./connection-context.mjs"
|
|
@@ -149,7 +150,7 @@ async function handleLine(line) {
|
|
|
149
150
|
if (message.params.arguments?.reconnect !== true) {
|
|
150
151
|
try {
|
|
151
152
|
await accessToken(config, configDirectory(config))
|
|
152
|
-
reply(content(
|
|
153
|
+
reply(content(connectionGuidance(config.tool)))
|
|
153
154
|
write({ jsonrpc: "2.0", method: "notifications/tools/list_changed" })
|
|
154
155
|
return
|
|
155
156
|
} catch (error) {
|
|
@@ -12,3 +12,14 @@ After connection, use [acent-memory](../acent-memory/SKILL.md) when the current
|
|
|
12
12
|
When continuing saved work, search and read the relevant evidence first. If several tasks fit or the next step remains unclear after a focused search, call `request_clarification` with one question and 2–3 evidence-based choices in the user's language. The question must appear inside the current coding agent, never on an Acent page. If the tool returns `needs_user_input`, use the host's native question tool or ask in this chat and wait. Do not answer for the user, retry a cancelled question, or change code dependent on an unresolved choice. After the reply, check the selected evidence against current files before continuing.
|
|
13
13
|
|
|
14
14
|
For “continue my recent work” without a specific topic, start with `get_recent_work` when available. Read its references, distinguish message time from archive storage time, and reconstruct the last request, completed work, remaining work and later corrections. Do not assume the newest conversation is unfinished. If the tool is unavailable because original access is not granted, explain the coverage limit and search permitted summaries or ask for the task topic; never bypass the connection scope.
|
|
15
|
+
|
|
16
|
+
## After authorization
|
|
17
|
+
|
|
18
|
+
Use the returned host-specific guidance in the user's language. Acent authorization and host plugin permissions are separate. Do not request a restart solely because connection finished, and do not claim saving has been verified just because authentication succeeded.
|
|
19
|
+
|
|
20
|
+
- Codex: if conversation saving was enabled, hooks require review and trust. Mention this only when trust is unconfirmed; never claim you approved it. Do not repeat an already completed approval.
|
|
21
|
+
- Claude Code: do not invent a separate hook approval. Explain workspace or tool permissions only when the host actually requests them. A new session or `/reload-plugins` is for missing or changed plugins, not routine connection completion.
|
|
22
|
+
- Cursor: local plugin installation needs restart or Developer: Reload Window. If Acent is already connected in this session, do not request another reload or invent a hook approval step.
|
|
23
|
+
- Antigravity: enabled plugin hooks run automatically. Do not prescribe hook approval or restart after connection. Investigate missing components or a disabled plugin before suggesting a new conversation.
|
|
24
|
+
|
|
25
|
+
If saving is disabled, omit saving-related instructions. If the tool cannot report host approval or hook execution state, say it is unverified rather than diagnosing a failure. Continue the original task after successful connection.
|
package/antigravity/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Ask your agent to find relevant context in Acent, for example:
|
|
|
18
18
|
|
|
19
19
|
## Conversation saving
|
|
20
20
|
|
|
21
|
-
After you approve saving and
|
|
21
|
+
After you approve saving and the plugin is enabled, Acent saves completed user and assistant text from supported Antigravity conversations. Earlier conversations are not imported. Each project folder needs its own connection.
|
|
22
22
|
|
|
23
23
|
Your agent can retrieve context from the approved project and account-wide memory. You can revoke the connection in Acent settings.
|
|
24
24
|
|
package/antigravity/plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://antigravity.google/schemas/v1/plugin.json",
|
|
3
3
|
"name": "acent",
|
|
4
4
|
"displayName": "Acent",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.4",
|
|
6
6
|
"description": "Connect conversations across your projects and carry context into your next task.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Cirtium"
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cirtium/acent-connect",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Install and connect the shared Acent coding-tool plugin",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/cirtiumcom/Acent.git",
|
|
9
|
+
"directory": "integrations"
|
|
10
|
+
},
|
|
6
11
|
"bin": {
|
|
7
12
|
"acent": "scripts/acent.mjs",
|
|
8
13
|
"acent-connect": "scripts/acent.mjs"
|
|
@@ -17,5 +22,8 @@
|
|
|
17
22
|
".claude-plugin",
|
|
18
23
|
"README.md",
|
|
19
24
|
"antigravity"
|
|
20
|
-
]
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"smol-toml": "^1.9.1"
|
|
28
|
+
}
|
|
21
29
|
}
|
package/scripts/acent.mjs
CHANGED
|
@@ -1,86 +1,56 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { installationGuidance } from "../acent/scripts/host-guidance.mjs"
|
|
2
3
|
import { pathToFileURL } from "node:url"
|
|
3
4
|
import { realpathSync } from "node:fs"
|
|
4
5
|
import { stat } from "node:fs/promises"
|
|
5
|
-
import {
|
|
6
|
+
import { chooseTool } from "./choose-tool.mjs"
|
|
6
7
|
import { main as adapter, options } from "../acent/scripts/acent-connect.mjs"
|
|
7
8
|
import {
|
|
8
9
|
tools,
|
|
9
10
|
aliases,
|
|
10
|
-
detect,
|
|
11
11
|
isManagedInstallation,
|
|
12
12
|
installPlugin,
|
|
13
13
|
run,
|
|
14
14
|
} from "./install-plugin.mjs"
|
|
15
15
|
export { installationCommands } from "./install-plugin.mjs"
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
if (!process.stdin.isTTY)
|
|
19
|
-
throw new Error(
|
|
20
|
-
"Specify --tool codex|claude|cursor|antigravity when running without a terminal."
|
|
21
|
-
)
|
|
22
|
-
const found = await Promise.all(tools.map((tool) => detect(tool)))
|
|
23
|
-
const prompt = createInterface({
|
|
24
|
-
input: process.stdin,
|
|
25
|
-
output: process.stderr,
|
|
26
|
-
})
|
|
27
|
-
try {
|
|
28
|
-
console.error("Choose your AI tool:")
|
|
29
|
-
tools.forEach((tool, i) =>
|
|
30
|
-
console.error(
|
|
31
|
-
` ${i + 1}. ${tool} — ${found[i] ? "installation command available" : "installation command not found"}`
|
|
32
|
-
)
|
|
33
|
-
)
|
|
34
|
-
const answer = (
|
|
35
|
-
await prompt.question("Tool number or name (Ctrl+C to cancel): ")
|
|
36
|
-
).trim()
|
|
37
|
-
return tools[Number(answer) - 1] || answer
|
|
38
|
-
} finally {
|
|
39
|
-
prompt.close()
|
|
40
|
-
}
|
|
41
|
-
}
|
|
17
|
+
const choose = () => chooseTool(tools)
|
|
42
18
|
|
|
43
19
|
async function applyPlugin(tool, command, settings, folder, execute, dependencies) {
|
|
44
|
-
const executable = await (dependencies.detect || detect)(tool, settings.executable)
|
|
45
|
-
if (!executable)
|
|
46
|
-
throw new Error(
|
|
47
|
-
`${tool}'s plugin installation command was not found. The app may be installed without its CLI. Install or enable its CLI, or supply --executable PATH. No connection was started.`
|
|
48
|
-
)
|
|
49
20
|
const installed = await (dependencies.install || installPlugin)(tool, {
|
|
50
21
|
command,
|
|
51
|
-
executable,
|
|
52
22
|
folder,
|
|
53
23
|
execute,
|
|
54
24
|
})
|
|
55
|
-
const action = command === "update" ? "updated" : "
|
|
25
|
+
const action = command === "update" ? "files and settings updated" : "files and settings prepared"
|
|
56
26
|
console.error(`Acent ${installed.version} ${action} for ${tool}.`)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"Reload Cursor and check Customize. Organization policies or a marketplace copy may take precedence over this local plugin."
|
|
60
|
-
)
|
|
61
|
-
console.error(
|
|
62
|
-
"Start a new tool session. Review and trust the plugin hooks in your tool; installation does not approve conversation saving."
|
|
63
|
-
)
|
|
27
|
+
console.error(installationGuidance(tool))
|
|
28
|
+
return true
|
|
64
29
|
}
|
|
65
30
|
|
|
66
|
-
async function
|
|
31
|
+
async function applyAll(command, settings, execute, dependencies) {
|
|
67
32
|
const folder = settings.folder || process.cwd()
|
|
68
33
|
if (!(await stat(folder)).isDirectory())
|
|
69
34
|
throw new Error("Choose an existing directory.")
|
|
35
|
+
const updating = command === "update"
|
|
70
36
|
const failures = []
|
|
71
|
-
let
|
|
37
|
+
let completed = 0
|
|
72
38
|
for (const tool of tools) {
|
|
73
39
|
try {
|
|
74
|
-
if (!(await (dependencies.isManaged || isManagedInstallation)(tool))) continue
|
|
75
|
-
await applyPlugin(
|
|
76
|
-
|
|
40
|
+
if (updating && !(await (dependencies.isManaged || isManagedInstallation)(tool))) continue
|
|
41
|
+
const applied = await applyPlugin(
|
|
42
|
+
tool, command, { skipUnavailable: !updating }, folder, execute, dependencies
|
|
43
|
+
)
|
|
44
|
+
if (applied) completed++
|
|
77
45
|
} catch (error) {
|
|
78
46
|
failures.push(`${tool}: ${error.message}`)
|
|
79
47
|
}
|
|
80
48
|
}
|
|
81
49
|
if (failures.length)
|
|
82
|
-
throw new Error(`Acent could not
|
|
83
|
-
if (!
|
|
50
|
+
throw new Error(`Acent could not ${command} for every tool:\n${failures.join("\n")}`)
|
|
51
|
+
if (!completed && !updating)
|
|
52
|
+
throw new Error("No plugins were installed.")
|
|
53
|
+
if (!completed) console.error("No Acent plugins installed by this CLI were found.")
|
|
84
54
|
}
|
|
85
55
|
|
|
86
56
|
export async function main(
|
|
@@ -92,7 +62,7 @@ export async function main(
|
|
|
92
62
|
args = [...args]
|
|
93
63
|
if (args.includes("--help") || args[0] === "help") {
|
|
94
64
|
console.log(
|
|
95
|
-
"Usage: acent [connect|install|update|disconnect|flush] [--tool codex|claude|cursor|antigravity] [--folder PATH]
|
|
65
|
+
"Usage: acent [connect|install|update|disconnect|flush] [--tool codex|claude|cursor|antigravity] [--folder PATH]\n acent install --all\n acent update --all\nNo command starts interactive connection. Run in the project folder to connect.\ninstall: install without authorization; update: apply this CLI release without changing grants.\ninstall --all: prepare Acent for all four supported tools.\nupdate --all: update all plugins installed by the Acent CLI.\nGet the latest CLI release before running update. Node 22+ required."
|
|
96
66
|
)
|
|
97
67
|
return
|
|
98
68
|
}
|
|
@@ -121,9 +91,9 @@ export async function main(
|
|
|
121
91
|
i++
|
|
122
92
|
}
|
|
123
93
|
if (all) {
|
|
124
|
-
if (
|
|
125
|
-
throw new Error("Use --all with update without --tool or --executable.")
|
|
126
|
-
return
|
|
94
|
+
if (!["install", "update"].includes(command) || settings.tool || settings.executable)
|
|
95
|
+
throw new Error("Use --all with install or update without --tool or --executable.")
|
|
96
|
+
return applyAll(command, settings, execute, dependencies)
|
|
127
97
|
}
|
|
128
98
|
const selected = settings.tool || (await (dependencies.choose || choose)())
|
|
129
99
|
const tool = tools.includes(selected)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { emitKeypressEvents, cursorTo, clearLine, moveCursor } from "node:readline"
|
|
2
|
+
import { createInterface } from "node:readline/promises"
|
|
3
|
+
|
|
4
|
+
export async function chooseTool(tools, {
|
|
5
|
+
input = process.stdin,
|
|
6
|
+
output = process.stderr,
|
|
7
|
+
env = process.env,
|
|
8
|
+
} = {}) {
|
|
9
|
+
if (!input.isTTY) {
|
|
10
|
+
throw new Error("Specify --tool codex|claude|cursor|antigravity when running without a terminal.")
|
|
11
|
+
}
|
|
12
|
+
// Redirected output and basic terminals retain a readable numbered prompt.
|
|
13
|
+
if (!output.isTTY || !input.setRawMode || env.TERM === "dumb" || (output.columns && output.columns < 24)) {
|
|
14
|
+
// This branch is plain text even if the stream advertises TTY support.
|
|
15
|
+
// Otherwise readline uses the real TERM and emits cursor-control sequences.
|
|
16
|
+
const prompt = createInterface({ input, output, terminal: false })
|
|
17
|
+
try {
|
|
18
|
+
output.write("Choose your AI tool:\n" + tools.map((tool, i) => ` ${i + 1}. ${tool}`).join("\n") + "\n")
|
|
19
|
+
const answer = (await prompt.question("Tool number or name (Ctrl+C to cancel): ")).trim()
|
|
20
|
+
return tools[Number(answer) - 1] || answer
|
|
21
|
+
} finally {
|
|
22
|
+
prompt.close()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const color = env.NO_COLOR === undefined
|
|
27
|
+
const previousRaw = Boolean(input.isRaw)
|
|
28
|
+
const wasFlowing = input.readableFlowing === true
|
|
29
|
+
let selected = 0
|
|
30
|
+
let rendered = false
|
|
31
|
+
const draw = () => {
|
|
32
|
+
if (rendered) moveCursor(output, 0, -tools.length)
|
|
33
|
+
for (let i = 0; i < tools.length; i++) {
|
|
34
|
+
cursorTo(output, 0)
|
|
35
|
+
clearLine(output, 0)
|
|
36
|
+
const text = `${i === selected ? "›" : " "} ${tools[i]}`
|
|
37
|
+
output.write(i === selected && color ? `\x1b[1;36m${text}\x1b[0m\n` : text + "\n")
|
|
38
|
+
}
|
|
39
|
+
rendered = true
|
|
40
|
+
}
|
|
41
|
+
output.write("Choose your AI tool:\n↑/↓ move · Enter select\nCtrl+C cancel\n\n")
|
|
42
|
+
emitKeypressEvents(input)
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
let finished = false
|
|
45
|
+
function finish(error) {
|
|
46
|
+
if (finished) return
|
|
47
|
+
finished = true
|
|
48
|
+
input.off("keypress", onKey)
|
|
49
|
+
input.off("end", onEnd)
|
|
50
|
+
input.off("error", onError)
|
|
51
|
+
input.setRawMode(previousRaw)
|
|
52
|
+
if (!wasFlowing) input.pause()
|
|
53
|
+
output.write(error ? "Selection cancelled.\n" : `Selected: ${tools[selected]}\n`)
|
|
54
|
+
if (error) reject(error)
|
|
55
|
+
else resolve(tools[selected])
|
|
56
|
+
}
|
|
57
|
+
function onEnd() { finish(new Error("Tool selection ended before a choice was made.")) }
|
|
58
|
+
function onError(error) { finish(error) }
|
|
59
|
+
function onKey(_text, key = {}) {
|
|
60
|
+
if (key.ctrl && (key.name === "c" || key.name === "d") || key.name === "escape") {
|
|
61
|
+
const error = new Error("Installation cancelled. No tool was selected.")
|
|
62
|
+
error.code = "ABORT_ERR"
|
|
63
|
+
finish(error)
|
|
64
|
+
} else if (key.name === "return" || key.name === "enter") {
|
|
65
|
+
finish()
|
|
66
|
+
} else if (key.name === "up" || key.name === "down") {
|
|
67
|
+
selected = (selected + (key.name === "up" ? -1 : 1) + tools.length) % tools.length
|
|
68
|
+
draw()
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
input.on("keypress", onKey)
|
|
72
|
+
input.once("end", onEnd)
|
|
73
|
+
input.once("error", onError)
|
|
74
|
+
try {
|
|
75
|
+
input.setRawMode(true)
|
|
76
|
+
draw()
|
|
77
|
+
input.resume()
|
|
78
|
+
} catch (error) {
|
|
79
|
+
finish(error)
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { registerLocal } from "./local-registration.mjs"
|
|
1
2
|
import { spawn, spawnSync } from "node:child_process"
|
|
2
3
|
import {
|
|
3
4
|
cp,
|
|
4
5
|
mkdir,
|
|
5
6
|
mkdtemp,
|
|
6
7
|
readFile,
|
|
8
|
+
readdir,
|
|
7
9
|
writeFile,
|
|
8
10
|
rename,
|
|
9
11
|
rm,
|
|
@@ -43,13 +45,49 @@ export function probe(tool, executable) {
|
|
|
43
45
|
args: ["plugin", "--help"],
|
|
44
46
|
}
|
|
45
47
|
}
|
|
48
|
+
|
|
49
|
+
async function claudeDesktopExecutables(home) {
|
|
50
|
+
const root = join(home, "Library/Application Support/Claude/claude-code")
|
|
51
|
+
const versions = (await readdir(root, { withFileTypes: true }).catch(() => []))
|
|
52
|
+
.filter((entry) => entry.isDirectory() && /^\d+\.\d+\.\d+$/.test(entry.name))
|
|
53
|
+
.sort((a, b) => b.name.localeCompare(a.name, "en", { numeric: true }))
|
|
54
|
+
const executables = []
|
|
55
|
+
for (const version of versions) {
|
|
56
|
+
const directory = join(root, version.name)
|
|
57
|
+
const builds = await readdir(directory, { withFileTypes: true }).catch(() => [])
|
|
58
|
+
for (const entry of builds) {
|
|
59
|
+
if (entry.isDirectory() && /^[a-f0-9]+$/i.test(entry.name))
|
|
60
|
+
executables.push(
|
|
61
|
+
join(directory, entry.name, "claude.app/Contents/MacOS/claude")
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return executables
|
|
66
|
+
}
|
|
67
|
+
|
|
46
68
|
export async function detect(tool, explicit) {
|
|
47
69
|
const info = probe(tool, explicit)
|
|
70
|
+
const home = homedir()
|
|
48
71
|
const candidates = explicit
|
|
49
72
|
? [explicit]
|
|
50
|
-
: [info.executable, join(
|
|
73
|
+
: [info.executable, join(home, ".local/bin", info.executable)]
|
|
51
74
|
if (tool === "Antigravity" && !explicit)
|
|
52
|
-
candidates.push(join(
|
|
75
|
+
candidates.push(join(home, ".antigravity/antigravity/bin/agy"))
|
|
76
|
+
if (!explicit && process.platform === "darwin") {
|
|
77
|
+
if (tool === "Codex") {
|
|
78
|
+
for (const applications of ["/Applications", join(home, "Applications")]) {
|
|
79
|
+
candidates.push(
|
|
80
|
+
join(applications, "Codex.app/Contents/Resources/codex"),
|
|
81
|
+
join(
|
|
82
|
+
applications,
|
|
83
|
+
"ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex"
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (tool === "Claude Code")
|
|
89
|
+
candidates.push(...(await claudeDesktopExecutables(home)))
|
|
90
|
+
}
|
|
53
91
|
for (const executable of candidates) {
|
|
54
92
|
const result = spawnSync(executable, info.args, {
|
|
55
93
|
encoding: "utf8",
|
|
@@ -142,7 +180,9 @@ export async function run(command, args, cwd) {
|
|
|
142
180
|
}
|
|
143
181
|
|
|
144
182
|
function pluginRoot(tool, home) {
|
|
145
|
-
return tool === "
|
|
183
|
+
return tool === "Antigravity"
|
|
184
|
+
? join(home, ".gemini/config/plugins/acent")
|
|
185
|
+
: tool === "Cursor"
|
|
146
186
|
? join(home, ".cursor/plugins/local/acent")
|
|
147
187
|
: join(home, ".local/share/acent/plugins", keys[tool])
|
|
148
188
|
}
|
|
@@ -160,7 +200,12 @@ export async function isManagedInstallation(tool, home = homedir()) {
|
|
|
160
200
|
if (error.code !== "ENOENT") throw error
|
|
161
201
|
return null
|
|
162
202
|
})
|
|
163
|
-
|
|
203
|
+
if ((await readInstallation(root, info))?.owner === "acent-cli") return true
|
|
204
|
+
if (tool === "Antigravity") {
|
|
205
|
+
const legacy = join(home, ".local/share/acent/plugins/antigravity")
|
|
206
|
+
return (await readInstallation(legacy, await lstat(legacy).catch(() => null)))?.owner === "acent-cli"
|
|
207
|
+
}
|
|
208
|
+
return false
|
|
164
209
|
}
|
|
165
210
|
|
|
166
211
|
// Plugin code is separate from grants and queues. Never replace an unowned folder.
|
|
@@ -173,6 +218,7 @@ export async function installPlugin(
|
|
|
173
218
|
home = homedir(),
|
|
174
219
|
execute = run,
|
|
175
220
|
source = packageRoot,
|
|
221
|
+
register = registerLocal,
|
|
176
222
|
} = {}
|
|
177
223
|
) {
|
|
178
224
|
const root = pluginRoot(tool, home)
|
|
@@ -193,7 +239,12 @@ export async function installPlugin(
|
|
|
193
239
|
if (error.code !== "ENOENT") throw error
|
|
194
240
|
return null
|
|
195
241
|
})
|
|
196
|
-
|
|
242
|
+
let previous = await readInstallation(root, info)
|
|
243
|
+
if (!info && tool === "Antigravity") {
|
|
244
|
+
const legacy = join(home, ".local/share/acent/plugins/antigravity")
|
|
245
|
+
const record = await readInstallation(legacy, await lstat(legacy).catch(() => null))
|
|
246
|
+
if (record?.owner === "acent-cli") previous = record
|
|
247
|
+
}
|
|
197
248
|
if (info && previous?.owner !== "acent-cli")
|
|
198
249
|
throw new Error(
|
|
199
250
|
`Existing plugin at ${root} is not managed by the Acent CLI. Keep it intact and remove or relocate it through your tool before installing.`
|
|
@@ -215,6 +266,15 @@ export async function installPlugin(
|
|
|
215
266
|
recursive: true,
|
|
216
267
|
})
|
|
217
268
|
}
|
|
269
|
+
// The installer knows Node's real executable and the final plugin location.
|
|
270
|
+
// Pin local MCP launches so desktop apps need neither Node nor a host CLI on PATH.
|
|
271
|
+
const nested = tool === "Codex" || tool === "Claude Code"
|
|
272
|
+
const configName = { Codex: "mcp-codex.json", "Claude Code": "mcp-claude.json", Cursor: "mcp-cursor.json", Antigravity: "mcp_config.json" }[tool]
|
|
273
|
+
const mcpPath = join(payload, ...(nested ? ["acent"] : []), configName)
|
|
274
|
+
const mcp = JSON.parse(await readFile(mcpPath, "utf8"))
|
|
275
|
+
mcp.mcpServers.acent.command = process.execPath
|
|
276
|
+
mcp.mcpServers.acent.args[0] = join(root, ...(nested ? ["acent"] : []), "scripts/mcp-proxy.mjs")
|
|
277
|
+
await writeFile(mcpPath, JSON.stringify(mcp, null, 2) + "\n")
|
|
218
278
|
const version = JSON.parse(
|
|
219
279
|
await readFile(join(source, "package.json"), "utf8")
|
|
220
280
|
).version
|
|
@@ -229,13 +289,7 @@ export async function installPlugin(
|
|
|
229
289
|
await rename(payload, root)
|
|
230
290
|
replaced = true
|
|
231
291
|
try {
|
|
232
|
-
|
|
233
|
-
tool,
|
|
234
|
-
root,
|
|
235
|
-
executable,
|
|
236
|
-
Boolean(previous)
|
|
237
|
-
))
|
|
238
|
-
await execute(program, argv, folder)
|
|
292
|
+
await register(tool, root, home)
|
|
239
293
|
} catch (error) {
|
|
240
294
|
await rm(root, { recursive: true, force: true })
|
|
241
295
|
replaced = false
|
|
@@ -244,7 +298,7 @@ export async function installPlugin(
|
|
|
244
298
|
backup = undefined
|
|
245
299
|
}
|
|
246
300
|
throw new Error(
|
|
247
|
-
`${error.message} Previous local files restored.
|
|
301
|
+
`${error.message} Previous local files restored. Retry acent install after resolving the settings error. Your connection and queued data were not changed.`
|
|
248
302
|
)
|
|
249
303
|
}
|
|
250
304
|
return { root, version }
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { homedir } from "node:os"
|
|
2
|
+
import { parse, stringify } from "smol-toml"
|
|
3
|
+
import { readFile, writeFile, mkdir, rename, rm } from "node:fs/promises"
|
|
4
|
+
import { dirname, join } from "node:path"
|
|
5
|
+
|
|
6
|
+
// One shared settings file per host. Lock it and replace atomically; never overwrite
|
|
7
|
+
// malformed settings or another plugin's entry. Leave host-owned caches alone.
|
|
8
|
+
export async function registerLocal(tool, root, home) {
|
|
9
|
+
if (tool !== "Codex" && tool !== "Claude Code") return
|
|
10
|
+
const path = tool === "Codex"
|
|
11
|
+
? join(home === homedir() && process.env.CODEX_HOME || join(home, ".codex"), "config.toml")
|
|
12
|
+
: join(home === homedir() && process.env.CLAUDE_CONFIG_DIR || join(home, ".claude"), "settings.json")
|
|
13
|
+
await mkdir(dirname(path), { recursive: true })
|
|
14
|
+
const lock = `${path}.acent-lock`
|
|
15
|
+
await mkdir(lock).catch(() => { throw new Error(`Settings are busy: ${path}. Retry after the other installer finishes.`) })
|
|
16
|
+
const temp = join(lock, "settings.json")
|
|
17
|
+
try {
|
|
18
|
+
const raw = await readFile(path, "utf8").catch(error => { if (error.code === "ENOENT") return null; throw error })
|
|
19
|
+
const data = raw === null ? {} : (tool === "Codex" ? parse(raw) : JSON.parse(raw))
|
|
20
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) throw new Error(`Invalid settings: ${path}`)
|
|
21
|
+
if (tool === "Codex") {
|
|
22
|
+
for (const key of ["marketplaces", "plugins"]) {
|
|
23
|
+
if (data[key] !== undefined && (!data[key] || typeof data[key] !== "object" || Array.isArray(data[key]))) throw new Error(`Invalid ${key}`)
|
|
24
|
+
data[key] ||= {}
|
|
25
|
+
}
|
|
26
|
+
const existing = data.marketplaces.acent
|
|
27
|
+
if (existing && (existing.source_type !== "local" || existing.source !== root)) throw new Error("A different Acent marketplace is already configured; existing settings preserved.")
|
|
28
|
+
data.marketplaces.acent = existing || { source_type: "local", source: root }
|
|
29
|
+
data.plugins["acent@acent"] ||= { enabled: true }
|
|
30
|
+
} else {
|
|
31
|
+
for (const key of ["extraKnownMarketplaces", "enabledPlugins"]) {
|
|
32
|
+
if (data[key] !== undefined && (!data[key] || typeof data[key] !== "object" || Array.isArray(data[key]))) throw new Error(`Invalid ${key}`)
|
|
33
|
+
data[key] ||= {}
|
|
34
|
+
}
|
|
35
|
+
const existing = data.extraKnownMarketplaces.acent
|
|
36
|
+
if (existing && (existing.source?.source !== "directory" || existing.source?.path !== root)) throw new Error("A different Acent marketplace is already configured; existing settings preserved.")
|
|
37
|
+
data.extraKnownMarketplaces.acent = existing || { source: { source: "directory", path: root } }
|
|
38
|
+
// Preserve an explicit user decision to disable the plugin.
|
|
39
|
+
data.enabledPlugins["acent@acent"] ??= true
|
|
40
|
+
}
|
|
41
|
+
await writeFile(temp, (tool === "Codex" ? stringify(data) : JSON.stringify(data, null, 2) + "\n"), { mode: 0o600 })
|
|
42
|
+
// Detect concurrent edits by the app before replacing its settings.
|
|
43
|
+
const current = await readFile(path, "utf8").catch(error => { if (error.code === "ENOENT") return null; throw error })
|
|
44
|
+
if (current !== raw) throw new Error("Settings changed during installation; retry. Existing settings preserved.")
|
|
45
|
+
await rename(temp, path)
|
|
46
|
+
} finally {
|
|
47
|
+
await rm(lock, { recursive: true, force: true })
|
|
48
|
+
}
|
|
49
|
+
}
|