magic-spells 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Magic Spells
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # Temporary Holding Version
1
+ # magic-spells
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `magic`: one command line and MCP server for Magic Spells' hosted services. Node 24 or newer.
4
+
5
+ ```sh
6
+ npx -y magic-spells --help # or: npm i -g magic-spells
7
+ ```
8
+
9
+ ## Sign in with a product key
10
+
11
+ ```sh
12
+ magic login --product-key # paste the key at the hidden prompt
13
+ echo "$KEY" | magic login --product-key pyramid # or pipe it (CI)
14
+ magic whoami # where each key comes from, and who it is
15
+ magic logout # forget every stored key (--product <p> for one)
16
+ ```
17
+
18
+ Keys are read from the prompt or stdin, never from arguments, and stored in the macOS
19
+ Keychain (service `io.magicspells.cli`) or, elsewhere, a mode-0600 file in
20
+ `~/.config/magic/credentials.json`. A key in the environment wins over a stored one.
21
+ `magic pyramid login` is the browser sign-in that mints a Pyramid key for you.
22
+
23
+ ## Commands
24
+
25
+ | Command | Does |
26
+ |---|---|
27
+ | `magic login --product-key [<product>]` | store a product key (product detected from the key's prefix) |
28
+ | `magic logout [--product <p>]` | forget stored keys |
29
+ | `magic whoami [--json]` | per product: key source (env, keychain, file, none), masked key, identity |
30
+ | `magic doctor [--json]` | Node, credential store, and per product: API reachable, key present, product checks |
31
+ | `magic mcp [--products a,b]` | the MCP server over stdio: every product's tools, prefixed (`pyramid_*`) |
32
+ | `magic pyramid <noun> <verb>` | Pyramid: `task next`, `task move WEB-42 --status "In Review"`, `task comment`, `project list`, `whoami`, … (`magic pyramid --help`) |
33
+
34
+ Global flags: `--json`, `--yes/-y`, `--no-color`, `--quiet/-q`, `--workspace <handle>`.
35
+ Output is JSON whenever stdout is not a terminal; errors go to stderr as
36
+ `{ "error": { "code", "message", "hint", "product" } }`.
37
+
38
+ ## MCP
39
+
40
+ ```sh
41
+ claude mcp add magic -- npx -y magic-spells mcp
42
+ ```
43
+
44
+ A product without a key still lists its tools; their calls answer `not_logged_in` until a
45
+ key is stored, without restarting the server.
46
+
47
+ ## Environment
48
+
49
+ | Variable | Meaning |
50
+ |---|---|
51
+ | `MAGIC_<PRODUCT>_KEY` | the product's key, e.g. `MAGIC_PYRAMID_KEY=pyramid_…`; never stored |
52
+ | `MAGIC_<PRODUCT>_URL` | the product's API base URL, e.g. `MAGIC_PYRAMID_URL` |
53
+ | `MAGIC_ALLOW_DESTRUCTIVE=1` | allow destructive operations (with `--yes`, or `yes: true` in MCP) |
54
+ | `MAGIC_CREDENTIALS_FILE=1` | store keys in the 0600 file instead of the OS keychain |
55
+ | `XDG_CONFIG_HOME` | where `magic/` (config and credentials file) lives |
56
+ | `NO_COLOR` | no colour |
57
+
58
+ ## Exit codes
59
+
60
+ Scripts branch on the exit code, or on `error.code` in the JSON envelope: 0 ok, 1 unknown,
61
+ 2 usage, 3 not logged in or bad key, 4 permission denied, 5 not found, 6 ambiguous name,
62
+ 7 validation or conflict, 8 destructive action disabled, 9 rate limited, 10 network,
63
+ 11 product unavailable. The table lives in
64
+ [`packages/kit/src/errors.ts`](https://github.com/magic-spells/cli/blob/main/packages/kit/src/errors.ts)
65
+ (`exitCodeFor`).
66
+
67
+ MIT licensed.
package/bin/magic.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ // The `magic` binary. Plain JS so the Node version check runs before any modern syntax
3
+ // or dependency loads; everything else lives in the compiled shell (src/main.ts).
4
+
5
+ const major = Number(process.versions.node.split('.')[0]);
6
+ if (major < 24) {
7
+ process.stderr.write(`magic needs Node 24 or newer (this is Node ${process.versions.node}).\n`);
8
+ process.exit(1);
9
+ }
10
+
11
+ const { run } = await import('../dist/main.js');
12
+ process.exitCode = await run(process.argv.slice(2));