ainecto 0.6.0 → 0.8.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/README.md CHANGED
@@ -2,82 +2,69 @@
2
2
 
3
3
  Published as `ainecto`, `@ainecto/mcp` and `@ainecto/cli` — the same code. Command: `ainecto`.
4
4
 
5
- **In a terminal, from your repository root:** `npx -y ainecto@latest init` — it asks which role this
6
- repository's AI sessions should have and which AiNecto project to use, and signs you in through the
7
- browser if needed.
5
+ **Once per machine:** `npx -y ainecto@latest setup` — signs you in through the browser (once), checks the
6
+ connection, and connects Claude Code, Cursor, and Codex to AiNecto.
7
+
8
+ Every AI session sees the same AiNecto tools. What a tool may change is decided by your AiNecto
9
+ permissions on the workspace, project, or document it touches — the server refuses the rest. There are
10
+ no session roles (Design / Development / Test / Validation were removed in 0.8.0).
8
11
 
9
12
  ## For AI agents
10
13
 
11
- **Ask the user which role this repository's AI sessions should have — Design, Development, Test, or Validation. Never pick one yourself. Then, from the repository root: `npx -y ainecto@latest init --role <role>` (it signs the user in through the browser if needed).**
12
-
13
- - Use a long command timeout (at least 6 minutes): sign-in waits up to 5 minutes for the user.
14
- - If `init` lists projects, ask the user which one and re-run with `--project <uuid>`. If it says
15
- this is not the repository root, re-run from the folder it names.
16
- - **No restart is needed.** Right after `init`, keep working in the same session through the CLI:
17
- `ainecto` commands run from the repository read its role on every call (read `.ainecto/HARNESS.md`,
18
- then `ainecto tools list` and `ainecto tools call <tool> '<json>'`). Do not use MCP tools the session
19
- started with for that work — they keep the role (or no role) the session started with.
20
- - A new session is optional and only adds the role's MCP tools (Claude Code: exit, then `claude -c`
21
- in this folder to keep the conversation; approve the `ainecto` server from `.mcp.json` when asked).
22
- Codex: save the profile `init` prints and start with `codex -p <role>`.
23
- - **A server added during a session is not available in that session.** In our test, a server added
24
- with `claude mcp add` while Claude Code was running did not attach to the running session — that is
25
- why the CLI is the way to keep going. `/mcp` shows what the current session actually loaded.
26
- - Inside the repository, `ainecto` commands (`ainecto tools call …`) use the repository's role
27
- automatically — do not pass `--role`; a different `--role` is refused.
14
+ **Run `npx -y ainecto@latest setup` (use a long command timeout — at least 6 minutes: sign-in waits up
15
+ to 5 minutes for the user). Then run `npx -y ainecto@latest doctor` and do what it says.**
16
+
17
+ - To add AiNecto's working rules to a repository, run `npx -y ainecto@latest init` from its root. It
18
+ does not ask for a role or a project.
19
+ - **A server added during a session is not available in that session.** Keep working through the CLI:
20
+ `npx -y ainecto@latest tools list` and `npx -y ainecto@latest tools call <tool> '<json>'`. A new
21
+ session loads the MCP tools.
22
+ - If a result names a tool that is not in your tool list, the session started before that tool was
23
+ added — start a new session or call it through the CLI as above.
28
24
  - Claude Code's auto mode may block running an external package with `npx`. If it does, ask the user
29
25
  to allow the command.
30
26
 
31
- To connect AiNecto without a repository role (for example before `init`), add the remote server at
32
- **user scope** under the name `ainecto` — a local-scope entry would hide the `.mcp.json` that `init`
33
- writes, and a different name would sit next to it as a second server with no role:
27
+ ## Set up this machine
34
28
 
35
29
  ```bash
36
- claude mcp add --scope user --transport http ainecto https://ainecto.com/mcp # Claude Code
37
- codex mcp add ainecto --url https://ainecto.com/mcp # Codex
30
+ npx -y ainecto@latest setup # sign in, check, connect Claude Code · Cursor · Codex
31
+ npx -y ainecto@latest setup --dry-run # show what it would do — no sign-in, no changes
32
+ npx -y ainecto@latest setup --undo # remove the connections setup made (sign-in stays)
33
+ npx -y ainecto@latest status # who is signed in, your AiNecto role, what is connected
34
+ npx -y ainecto@latest doctor # what is missing, and the one command that fixes each item
38
35
  ```
39
36
 
40
- The client signs the user in on first use. That session has no role until `init` runs and a new
41
- session starts.
37
+ `setup` connects each client separately and reports `connected`, `updated`, `kept` (someone else's
38
+ `ainecto` entry, left untouched), `not installed`, or `failed`; if any client fails it says «partial» and
39
+ exits 1:
40
+
41
+ - Claude Code — `claude mcp add -s user ainecto -- npx -y @ainecto/mcp@<version>` (user scope).
42
+ - Cursor — merges the same entry into `~/.cursor/mcp.json`, keeping your other servers.
43
+ - Codex — `codex mcp add ainecto -- npx -y @ainecto/mcp@<version>`.
42
44
 
43
- ## Set up a repository (roles)
45
+ The entry is pinned to the CLI version that wrote it; re-run `setup` to move to a newer one (`doctor`
46
+ tells you when one is available). Your AiNecto role (your job, set in AiNecto's account settings) is
47
+ shown by `setup` and `status`; AI uses it to pitch explanations — it does not change permissions.
48
+
49
+ ## Set up a repository (optional)
44
50
 
45
51
  ```bash
46
- npx -y ainecto@latest init # in a terminal: asks for the role and the project
47
- npx -y ainecto@latest init --role development # agents, scripts, CI: nothing is asked
52
+ npx -y ainecto@latest init # .ainecto/HARNESS.md, an AGENTS.md block (and CLAUDE.md if present), .ainecto/config.json
53
+ npx -y ainecto@latest init --mcp # also .mcp.json (Claude Code) and .cursor/mcp.json (Cursor)
54
+ npx -y ainecto@latest init --dry-run # the same plan, nothing written
55
+ npx -y ainecto@latest init --undo # remove what init wrote
48
56
  ```
49
57
 
50
- In a terminal (stdin and stdout both a TTY, no `--json`, and not under an agent or CI — `CLAUDECODE`,
51
- `CI`, `GEMINI_CLI`, `CODEX_SANDBOX`, `CURSOR_AGENT`) `init` asks for what was not given:
52
- - the role, unless `--role` or `AINECTO_ROLE` is set — by number, with no default. The role already
53
- set on the repository is the default only when there is one (if its agent configs disagree, there
54
- is no default);
55
- - the project, unless `--project` is set — by number; «Create a new project» is offered to Design only.
56
-
57
- Ctrl+C or Ctrl+D at a question cancels without writing repository files (Ctrl+D exits with 130). A
58
- sign-in you already completed stays saved, and choosing «Create a new project» creates it right away.
59
- Anywhere else (an agent's shell, CI) it asks nothing. In both cases:
60
-
61
- - If this machine is not signed in to AiNecto yet, `init` opens a browser and continues once the user
62
- approves — **once per machine** (per server), not per role. The sign-in URL is printed first (with
63
- `--json`, as one JSON line on stderr: `{"event":"login_url","url":…}`), and sign-in gives up after
64
- 5 minutes. It fails at once
65
- when the command that opens the browser is missing, or (except on Windows, where the exit code is
66
- not reliable) exits with an error.
67
- - Outside a terminal, with no `--role`/`AINECTO_ROLE` it uses the role already set on the repository.
68
- If there is none (or the repository's agent configs disagree) it stops and says to ask the user —
69
- it never picks a role for you. If the account has more than one project it lists them and stops;
70
- re-run with `--project <uuid>`. With no project yet,
71
- only a Design session can create one (`--yes`, optionally `--project-name <name>`); in any other
72
- role it asks you to have the user create the project, then re-run with the same role.
58
+ - `init` fetches the rules from the server — `--dry-run` too, so the plan is the real one. If it cannot
59
+ (not signed in, offline), it says which files would get this package's default text instead.
60
+ - If this machine is not signed in yet, `init` opens the browser once (`--dry-run` never does). The
61
+ sign-in URL is printed first (with `--json`, as one JSON line on stderr: `{"event":"login_url","url":…}`).
73
62
  - It stops when run from a sub-folder of a git repository, and tells you the root.
74
- - It writes one `ainecto` server entry carrying `--role` into `.mcp.json` (Claude Code) and
75
- `.cursor/mcp.json` (Cursor), and prints the Codex profile to use (`codex -p <role>`).
76
- - `ainecto` commands in the repository use the new role **at once**; MCP tools pick it up in a **new
77
- session** (a running session's MCP tools keep the role they started with). Roles are a working
78
- guardrail, not a security boundary.
79
- - `ainecto init --dry-run` shows what would change (it does not sign in or refresh a sign-in);
80
- `ainecto init --undo` removes what it wrote.
63
+ - **Repositories set up by 0.7.x** (`.mcp.json` with `--role`): re-run `npx -y ainecto@latest init`.
64
+ It rewrites the existing `ainecto` entry without `--role`, pinned to this version, and drops the old
65
+ `project` field from `.ainecto/config.json` (unless you changed it). Until then the old entry keeps
66
+ working: `--role` is accepted and ignored. Old flags (`--role`, `--project`, `--project-name`,
67
+ `--yes`) are ignored with a one-line note.
81
68
 
82
69
  ## Commands
83
70
 
@@ -87,7 +74,7 @@ and all ship the `ainecto` command, so a second global install conflicts. (`@ain
87
74
  `mcp`, the bridge.)
88
75
 
89
76
  ```bash
90
- ainecto auth login # once per machine (and per --env); not per role
77
+ ainecto auth login # once per machine (and per --env) — `setup` does this for you
91
78
  ainecto auth status
92
79
  ainecto auth logout
93
80
 
@@ -100,16 +87,6 @@ ainecto projects list
100
87
  ainecto erd apply-changes -f erd-operations.json --yes
101
88
  ```
102
89
 
103
- **The role comes from the repository.** Inside a folder set up with `ainecto init` (the command looks
104
- from the current folder upward for the first `.mcp.json`/`.cursor/mcp.json` with an `ainecto` entry),
105
- every command uses that folder's role without `--role`. A `--role` or `AINECTO_ROLE` that differs from
106
- it is refused — the role changes only with `ainecto init --role <role>`, after asking the user. If the
107
- role there cannot be read (the `@ainecto/mcp` bridge entry without a valid `--role`, configs that
108
- disagree, broken JSON that mentions `ainecto`, a link that points outside the folder), the command
109
- stops. An entry that is not this bridge (for example an HTTP
110
- `url` or `mcp-remote` entry) means no role there. Your home folder itself is never read as a
111
- repository (`~/.cursor/mcp.json` is Cursor's global config). Outside such a folder there is no role
112
- (no restriction), and `--role` narrows it.
113
90
  Tool names are the server's own names (`list_projects`, `erd_apply_changes`, …). Your AI client
114
91
  shows them with its own prefix, for example `mcp__ainecto__list_projects` in Claude Code; the CLI
115
92
  does not use that prefix. A tool name that starts with
@@ -159,41 +136,59 @@ ainecto attachments upload --document-uuid <documentUuid> ./diagram.png ./notes.
159
136
  The generated `request_upload_token` and `upload_attachments` paths remain raw MCP argument-contract
160
137
  commands and do not read local files.
161
138
 
139
+ Inbox polling — for a scheduler (cron, launchd) that wakes an agent only when something is new. Exit
140
+ codes: `0` new items, `3` nothing new, `1` error, `2` usage error. `notifications poll` saves the batch
141
+ to the cursor file before printing it and prints the same batch again until `notifications ack` (run
142
+ it only after the agent handled the batch). `agent-todos poll --only-new` exits 0 only for to-dos it
143
+ has not seen before (kept in the seen file). Both take `--workspace <uuid>` and `--project <uuid>`,
144
+ each repeatable: any of the given workspaces AND any of the given projects. Each filter is its
145
+ own notification stream, so use one cursor file per filter.
146
+
147
+ ```bash
148
+ ainecto notifications poll --direct-only --cursor-file ~/.ainecto/inbox.cursor --json > /tmp/inbox.json \
149
+ && claude -p "Summarize these AiNecto notifications: $(cat /tmp/inbox.json)" \
150
+ && ainecto notifications ack --cursor-file ~/.ainecto/inbox.cursor
151
+ ainecto agent-todos poll --only-new --seen-file ~/.ainecto/todos.seen --json > /tmp/todos.json \
152
+ && claude -p "Review these AiNecto to-dos and only summarize them: $(cat /tmp/todos.json)"
153
+ ```
154
+
155
+ The server tools behind them (`list_notifications`, `list_agent_todos`, `update_agent_todos`,
156
+ `list_history`) are generated commands too (`ainecto notifications list`, `ainecto agent-todos list`,
157
+ `ainecto agent-todos update -f …`, `ainecto history list`) once the server exposes them.
158
+
162
159
  ## Connector Mode
163
160
 
164
161
  ```bash
165
- ainecto mcp --role <design|development|test|validation> [--env dev]
162
+ ainecto mcp [--env dev]
166
163
  ```
167
164
 
168
165
  The package doubles as a stdio-to-HTTP proxy for the resolved `/mcp` endpoint. It proxies
169
166
  `initialize`, `tools/list`, and `tools/call`, does not rewrite remote schemas, and does not interpret
170
- local file references. It uses this machine's one sign-in (`ainecto auth login`, or the sign-in
171
- `ainecto init` performs) and never opens a browser on its own. Its role comes only from `--role` (or
172
- `AINECTO_ROLE`) and is sent with every request; the server applies it.
167
+ local file references. It uses this machine's one sign-in (`ainecto setup`, `ainecto auth login`, or
168
+ the sign-in `ainecto init` performs) and never opens a browser on its own.
173
169
 
174
- This is the entry `ainecto init` writes into a repository's MCP config — you normally do not add it
175
- by hand:
170
+ This is the entry `setup` and `init --mcp` write — you normally do not add it by hand:
176
171
 
177
172
  ```json
178
173
  {
179
174
  "mcpServers": {
180
175
  "ainecto": {
181
176
  "command": "npx",
182
- "args": ["-y", "@ainecto/mcp", "--role", "development"]
177
+ "args": ["-y", "@ainecto/mcp@0.8.0"]
183
178
  }
184
179
  }
185
180
  }
186
181
  ```
187
182
 
188
- A bridge without a role has no restriction. If a session inside a set-up repository still has no role,
189
- another `ainecto` entry (for example Claude Code's local scope) is usually hiding the one `init` wrote —
190
- check with `claude mcp get ainecto`. An entry under another name does not hide it but adds a second
191
- server with no role — remove it.
183
+ An older entry with `--role <name>` (or `AINECTO_ROLE`) still starts: the value is ignored, a one-line
184
+ note goes to stderr, and the server only records that an old setting is still in use. If a session
185
+ does not see the AiNecto tools, another `ainecto` entry (for example Claude Code's local scope) may be
186
+ hiding it — `ainecto doctor` checks this.
192
187
 
193
188
  ### MCP Registry
194
189
 
195
190
  `server.json` is the Registry entry `io.github.codelives/ainecto` (same as `package.json#mcpName`). It
196
- lists only the npm package `@ainecto/mcp` — the per-repository role bridge `init` writes. Registry
191
+ lists only the npm package `@ainecto/mcp` — the bridge `setup` and `init --mcp` write. Registry
197
192
  publication requires the npm version it references to carry that `mcpName`, so publish npm first.
198
193
  Registration is done by a person:
199
194