@jovie/cli 26.9.15
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 +203 -0
- package/README.md +108 -0
- package/dist/cli.d.ts +17 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +234 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +45 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +174 -0
- package/dist/client.js.map +1 -0
- package/dist/commands.d.ts +21 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +52 -0
- package/dist/commands.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +24 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +36 -0
- package/dist/init.js.map +1 -0
- package/dist/mcp.d.ts +22 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +148 -0
- package/dist/mcp.js.map +1 -0
- package/dist/skill.d.ts +3 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +53 -0
- package/dist/skill.js.map +1 -0
- package/package.json +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Copyright 2026 Jovie Technology Inc.
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
12
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
15
|
+
the copyright owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
18
|
+
other entities that control, are controlled by, or are under common
|
|
19
|
+
control with that entity. For the purposes of this definition,
|
|
20
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
21
|
+
direction or management of such entity, whether by contract or
|
|
22
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
23
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
24
|
+
|
|
25
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
26
|
+
exercising permissions granted by this License.
|
|
27
|
+
|
|
28
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
29
|
+
including but not limited to software source code, documentation
|
|
30
|
+
source, and configuration files.
|
|
31
|
+
|
|
32
|
+
"Object" form shall mean any form resulting from mechanical
|
|
33
|
+
transformation or translation of a Source form, including but
|
|
34
|
+
not limited to compiled object code, generated documentation,
|
|
35
|
+
and conversions to other media types.
|
|
36
|
+
|
|
37
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
38
|
+
Object form, made available under the License, as indicated by a
|
|
39
|
+
copyright notice that is included in or attached to the work
|
|
40
|
+
(an example is provided in the Appendix below).
|
|
41
|
+
|
|
42
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
43
|
+
form, that is based on (or derived from) the Work and for which the
|
|
44
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
45
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
46
|
+
of this License, Derivative Works shall not include works that remain
|
|
47
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
48
|
+
the Work and Derivative Works thereof.
|
|
49
|
+
|
|
50
|
+
"Contribution" shall mean any work of authorship, including
|
|
51
|
+
the original version of the Work and any modifications or additions
|
|
52
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
53
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
54
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
55
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
56
|
+
means any form of electronic, verbal, or written communication sent
|
|
57
|
+
to the Licensor or its representatives, including but not limited to
|
|
58
|
+
communication on electronic mailing lists, source code control systems,
|
|
59
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
60
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
61
|
+
excluding communication that is conspicuously marked or otherwise
|
|
62
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
63
|
+
|
|
64
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
65
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
66
|
+
subsequently incorporated within the Work.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent claims licensable
|
|
81
|
+
by such Contributor that are necessarily infringed by their
|
|
82
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
83
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
84
|
+
institute patent litigation against any entity (including a
|
|
85
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
86
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
87
|
+
or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License for that Work shall terminate
|
|
89
|
+
as of the date such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or
|
|
97
|
+
Derivative Works a copy of this License; and
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You changed the files; and
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright, patent, trademark, and
|
|
104
|
+
attribution notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not pertain to any part of
|
|
106
|
+
the Derivative Works; and
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
109
|
+
distribution, then any Derivative Works that You distribute must
|
|
110
|
+
include a readable copy of the attribution notices contained
|
|
111
|
+
within such NOTICE file, excluding those notices that do not
|
|
112
|
+
pertain to any part of the Derivative Works, in at least one
|
|
113
|
+
of the following places: within a NOTICE text file distributed
|
|
114
|
+
as part of the Derivative Works; within the Source form or
|
|
115
|
+
documentation, if provided along with the Derivative Works; or,
|
|
116
|
+
within a display generated by the Derivative Works, if and
|
|
117
|
+
wherever such third-party notices normally appear. The contents
|
|
118
|
+
of the NOTICE file are for informational purposes only and
|
|
119
|
+
do not modify the License. You may add Your own attribution
|
|
120
|
+
notices within Derivative Works that You distribute, alongside
|
|
121
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
122
|
+
that such additional attribution notices cannot be construed
|
|
123
|
+
as modifying the License.
|
|
124
|
+
|
|
125
|
+
You may add Your own copyright statement to Your modifications and
|
|
126
|
+
may provide additional or different license terms and conditions
|
|
127
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
128
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
129
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
130
|
+
the conditions stated in this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright [yyyy] [name of copyright owner]
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# `@jovie/cli`
|
|
2
|
+
|
|
3
|
+
Jovie for AI agents. One package is a CLI, an MCP server, and an agent skill.
|
|
4
|
+
An agent can give a music artist a Jovie profile from their Spotify artist
|
|
5
|
+
URL, then hand the artist a claim link. No login or API key is required.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Install an exact public release globally from npm:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install --global @jovie/cli
|
|
13
|
+
jovie --help
|
|
14
|
+
jovie --version
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or run without installing: `npx -y @jovie/cli --help`.
|
|
18
|
+
|
|
19
|
+
Use `npm view @jovie/cli version` to confirm registry availability before an
|
|
20
|
+
automated install. A repository build is not proof that npm has the package.
|
|
21
|
+
|
|
22
|
+
## Commands
|
|
23
|
+
|
|
24
|
+
| Command | Request |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `profile create <url>` | `POST /api/agents/profiles` with a Spotify artist URL |
|
|
27
|
+
| `artist get <username>` | `GET /api/v1/{username}` |
|
|
28
|
+
| `artist llms <username>` | `GET /{username}/llms.txt` |
|
|
29
|
+
| `api openapi` | `GET /api/v1/openapi.json` |
|
|
30
|
+
| `docs llms` | `GET /llms.txt` (`--full` for `/llms-full.txt`) |
|
|
31
|
+
| `mcp` | Serve the commands above as MCP tools over stdio |
|
|
32
|
+
| `init` | Install `jovie/SKILL.md` into each installed agent (Claude, Codex, OpenClaw, Hermes) |
|
|
33
|
+
| `skill` | Print the skill |
|
|
34
|
+
|
|
35
|
+
`profile create` returns the existing profile unchanged when one already holds
|
|
36
|
+
that Spotify artist. Otherwise it creates an unclaimed profile. The response
|
|
37
|
+
has `profileUrl` and, when unclaimed, a `claimUrl`. The claim URL is not an
|
|
38
|
+
ownership token: the artist still verifies that they own the Spotify artist.
|
|
39
|
+
Creation is anonymous and rate limited per IP.
|
|
40
|
+
|
|
41
|
+
`--json` emits JSON for API responses and wraps text resources as
|
|
42
|
+
`{"content":"..."}`. Failures print `{"error":{...}}`, and API failures carry
|
|
43
|
+
the server's stable `apiCode` (for example `RATE_LIMITED`). Successful commands
|
|
44
|
+
exit `0`, request/response failures exit `1`, and invalid usage exits `2`.
|
|
45
|
+
|
|
46
|
+
Every command accepts `--base-url <url>` for a compatible deployment origin.
|
|
47
|
+
The value must be an `http` or `https` origin without a path, credentials, or
|
|
48
|
+
query parameters.
|
|
49
|
+
|
|
50
|
+
## MCP
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{ "mcpServers": { "jovie": { "command": "npx", "args": ["-y", "@jovie/cli", "mcp"] } } }
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Tools: `create_profile`, `get_artist`, `get_artist_guide`, `get_openapi`,
|
|
57
|
+
`get_docs`. `server.json` describes the package for the MCP registry.
|
|
58
|
+
|
|
59
|
+
## JavaScript client
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import { createProfile, fetchArtist } from '@jovie/cli';
|
|
63
|
+
|
|
64
|
+
const profile = await createProfile('https://open.spotify.com/artist/<id>');
|
|
65
|
+
const artist = await fetchArtist('artist-username');
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Boundary
|
|
69
|
+
|
|
70
|
+
The CLI sends no credentials, caches nothing, and sends no telemetry beyond a
|
|
71
|
+
`jovie-cli/<version>` User-Agent. `profile create` is its only write. `init`
|
|
72
|
+
writes only `jovie/SKILL.md` into existing agent skill directories, or into
|
|
73
|
+
`--dir`. Commands use Node 22 built-ins (`parseArgs`, `fetch`, `readline`) and
|
|
74
|
+
have no runtime dependencies. The MCP server covers tools only; adopt the
|
|
75
|
+
official SDK when resources, prompts, or HTTP transport are needed.
|
|
76
|
+
|
|
77
|
+
Docs: [Jovie CLI](https://jov.ie/cli), [developer resources](https://jov.ie/developers).
|
|
78
|
+
|
|
79
|
+
## Release boundary
|
|
80
|
+
|
|
81
|
+
The package directory is licensed under Apache-2.0 (see `LICENSE`); the
|
|
82
|
+
repository root and unrelated packages remain proprietary. Its manifest is
|
|
83
|
+
configured with `private: false` and public npm `publishConfig` for the
|
|
84
|
+
`https://registry.npmjs.org` registry, including provenance. It intentionally
|
|
85
|
+
has no source-manifest `version`; the manual main-only release workflow stamps
|
|
86
|
+
the root `VERSION` into a temporary publication directory. A local build or
|
|
87
|
+
merged source change does not claim that npm publication succeeded.
|
|
88
|
+
|
|
89
|
+
The release-path smoke sequence, after the approval gate and a main-only
|
|
90
|
+
version stamp, is:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
pnpm --filter @jovie/cli run typecheck
|
|
94
|
+
pnpm --filter @jovie/cli run test:coverage
|
|
95
|
+
pnpm --filter @jovie/cli run build
|
|
96
|
+
pnpm --filter @jovie/cli run pack:dry
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`pack:dry` builds a temporary versioned package, checks its metadata,
|
|
100
|
+
declarations, and contents, installs that tarball into a clean temporary
|
|
101
|
+
directory, imports the installed library, and runs the installed binary against
|
|
102
|
+
a local HTTP server. Publication is performed only by the repository's manual
|
|
103
|
+
`npm-publish.yml` workflow from exact current `main`; do not run a raw publish
|
|
104
|
+
from this source directory.
|
|
105
|
+
|
|
106
|
+
The workflow must prove the public registry version, provenance metadata,
|
|
107
|
+
maintainer ownership, a fresh exact-version install, and a critical installed
|
|
108
|
+
command before the release is considered available.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { type FetchImplementation } from './client.js';
|
|
3
|
+
export declare const CLI_VERSION_FALLBACK = "0.0.0-private";
|
|
4
|
+
export declare function packageVersionFromText(manifestText: string): string;
|
|
5
|
+
export declare function resolveCliVersion(manifestPath?: string): string;
|
|
6
|
+
export interface CliOutput {
|
|
7
|
+
write(chunk: string): unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface CliDependencies {
|
|
10
|
+
readonly fetchImpl?: FetchImplementation;
|
|
11
|
+
readonly stdout?: CliOutput;
|
|
12
|
+
readonly stderr?: CliOutput;
|
|
13
|
+
readonly stdin?: NodeJS.ReadableStream;
|
|
14
|
+
readonly homeDir?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function runCli(argv: readonly string[], dependencies?: CliDependencies): Promise<number>;
|
|
17
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAQA,OAAO,EAEL,KAAK,mBAAmB,EAIzB,MAAM,aAAa,CAAC;AAMrB,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AAEpD,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAiBnE;AAED,wBAAgB,iBAAiB,CAC/B,YAAY,SAGX,GACA,MAAM,CAMR;AAID,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AA6JD,wBAAsB,MAAM,CAC1B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,YAAY,GAAE,eAAoB,GACjC,OAAO,CAAC,MAAM,CAAC,CAsEjB"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync, realpathSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { dirname, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { parseArgs } from 'node:util';
|
|
7
|
+
import { DEFAULT_BASE_URL, JovieInputError, JovieRequestError, normalizeBaseUrl, } from './client.js';
|
|
8
|
+
import { COMMANDS, findCommand } from './commands.js';
|
|
9
|
+
import { installSkill } from './init.js';
|
|
10
|
+
import { serveMcp } from './mcp.js';
|
|
11
|
+
import { SKILL_MD } from './skill.js';
|
|
12
|
+
export const CLI_VERSION_FALLBACK = '0.0.0-private';
|
|
13
|
+
export function packageVersionFromText(manifestText) {
|
|
14
|
+
try {
|
|
15
|
+
const parsed = JSON.parse(manifestText);
|
|
16
|
+
if (parsed !== null &&
|
|
17
|
+
typeof parsed === 'object' &&
|
|
18
|
+
!Array.isArray(parsed)) {
|
|
19
|
+
const version = parsed.version;
|
|
20
|
+
if (typeof version === 'string' && version.trim()) {
|
|
21
|
+
return version.trim();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Source and private worktrees may not have a release version yet.
|
|
27
|
+
}
|
|
28
|
+
return CLI_VERSION_FALLBACK;
|
|
29
|
+
}
|
|
30
|
+
export function resolveCliVersion(manifestPath = resolve(dirname(fileURLToPath(import.meta.url)), '../package.json')) {
|
|
31
|
+
try {
|
|
32
|
+
return packageVersionFromText(readFileSync(manifestPath, 'utf8'));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return CLI_VERSION_FALLBACK;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const CLI_VERSION = resolveCliVersion();
|
|
39
|
+
class UsageError extends Error {
|
|
40
|
+
code = 'USAGE_ERROR';
|
|
41
|
+
}
|
|
42
|
+
function usage() {
|
|
43
|
+
const width = 28;
|
|
44
|
+
const lines = COMMANDS.map(command => {
|
|
45
|
+
const name = [
|
|
46
|
+
...command.path,
|
|
47
|
+
...(command.arg ? [`<${command.arg.name}>`] : []),
|
|
48
|
+
].join(' ');
|
|
49
|
+
return ` ${name.padEnd(width)} ${command.summary}`;
|
|
50
|
+
});
|
|
51
|
+
return `Usage: jovie <command> [options]
|
|
52
|
+
|
|
53
|
+
Jovie for agents: create artist profiles from Spotify and read public artist
|
|
54
|
+
data. No login or API key. Every command supports --json.
|
|
55
|
+
|
|
56
|
+
Commands:
|
|
57
|
+
${lines.join('\n')}
|
|
58
|
+
${'mcp'.padEnd(width)} Run as an MCP server over stdio (same tools as above)
|
|
59
|
+
${'init'.padEnd(width)} Install the Jovie skill into Claude, Codex, OpenClaw, Hermes
|
|
60
|
+
${'skill'.padEnd(width)} Print the Jovie SKILL.md
|
|
61
|
+
|
|
62
|
+
Options:
|
|
63
|
+
--base-url <url> Compatible Jovie deployment origin (default: ${DEFAULT_BASE_URL})
|
|
64
|
+
--json Emit compact JSON; text resources use {"content":"..."}
|
|
65
|
+
--full Fetch /llms-full.txt (only with docs llms)
|
|
66
|
+
--dir <path> Skills directory for init (default: every installed agent)
|
|
67
|
+
-h, --help Show this help
|
|
68
|
+
-v, --version Show the installed CLI version
|
|
69
|
+
|
|
70
|
+
Examples:
|
|
71
|
+
jovie profile create https://open.spotify.com/artist/<id> --json
|
|
72
|
+
jovie artist get <username> --json
|
|
73
|
+
npx -y @jovie/cli mcp
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
function writeLine(output, value) {
|
|
77
|
+
output.write(`${value}\n`);
|
|
78
|
+
}
|
|
79
|
+
function writeText(output, value) {
|
|
80
|
+
output.write(value.endsWith('\n') ? value : `${value}\n`);
|
|
81
|
+
}
|
|
82
|
+
function errorPayload(error) {
|
|
83
|
+
if (error instanceof JovieRequestError) {
|
|
84
|
+
return {
|
|
85
|
+
code: error.code,
|
|
86
|
+
message: error.message,
|
|
87
|
+
...(error.apiCode ? { apiCode: error.apiCode } : {}),
|
|
88
|
+
...(error.status === undefined ? {} : { status: error.status }),
|
|
89
|
+
...(error.responseBody ? { responseBody: error.responseBody } : {}),
|
|
90
|
+
...(error.retryAfterSeconds === undefined
|
|
91
|
+
? {}
|
|
92
|
+
: { retryAfterSeconds: error.retryAfterSeconds }),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (error instanceof JovieInputError) {
|
|
96
|
+
return { code: error.code, message: error.message };
|
|
97
|
+
}
|
|
98
|
+
if (error instanceof UsageError) {
|
|
99
|
+
return { code: error.code, message: error.message };
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
code: 'CLI_ERROR',
|
|
103
|
+
message: error instanceof Error ? error.message : String(error),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function parseCliArgs(argv) {
|
|
107
|
+
const parsed = parseArgs({
|
|
108
|
+
args: [...argv],
|
|
109
|
+
options: {
|
|
110
|
+
'base-url': { type: 'string' },
|
|
111
|
+
dir: { type: 'string' },
|
|
112
|
+
full: { type: 'boolean' },
|
|
113
|
+
help: { type: 'boolean', short: 'h' },
|
|
114
|
+
json: { type: 'boolean' },
|
|
115
|
+
version: { type: 'boolean', short: 'v' },
|
|
116
|
+
},
|
|
117
|
+
allowPositionals: true,
|
|
118
|
+
strict: true,
|
|
119
|
+
});
|
|
120
|
+
const values = parsed.values;
|
|
121
|
+
return {
|
|
122
|
+
values: {
|
|
123
|
+
baseUrl: values['base-url'],
|
|
124
|
+
dir: values.dir,
|
|
125
|
+
full: values.full,
|
|
126
|
+
help: values.help,
|
|
127
|
+
json: values.json,
|
|
128
|
+
version: values.version,
|
|
129
|
+
},
|
|
130
|
+
positionals: parsed.positionals,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
async function execute(positionals, values, dependencies) {
|
|
134
|
+
const baseUrl = normalizeBaseUrl(values.baseUrl);
|
|
135
|
+
const [first] = positionals;
|
|
136
|
+
if (positionals.length === 1 && first === 'skill')
|
|
137
|
+
return SKILL_MD;
|
|
138
|
+
if (positionals.length === 1 && first === 'init') {
|
|
139
|
+
return installSkill(dependencies.homeDir ?? homedir(), values.dir);
|
|
140
|
+
}
|
|
141
|
+
const command = findCommand(positionals);
|
|
142
|
+
const expectedLength = command?.arg ? 3 : 2;
|
|
143
|
+
if (!command || positionals.length !== expectedLength) {
|
|
144
|
+
throw new UsageError(`Unknown command: ${positionals.join(' ')}`);
|
|
145
|
+
}
|
|
146
|
+
if (values.full && !command.acceptsFull) {
|
|
147
|
+
throw new UsageError('--full is only supported by docs llms');
|
|
148
|
+
}
|
|
149
|
+
return command.run({ arg: positionals[2], full: values.full === true }, {
|
|
150
|
+
baseUrl,
|
|
151
|
+
fetchImpl: dependencies.fetchImpl,
|
|
152
|
+
userAgent: `jovie-cli/${CLI_VERSION}`,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
export async function runCli(argv, dependencies = {}) {
|
|
156
|
+
const stdout = dependencies.stdout ?? process.stdout;
|
|
157
|
+
const stderr = dependencies.stderr ?? process.stderr;
|
|
158
|
+
const requestedJson = argv.includes('--json');
|
|
159
|
+
let parsed;
|
|
160
|
+
try {
|
|
161
|
+
parsed = parseCliArgs(argv);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
const usageError = new UsageError(error instanceof Error ? error.message : String(error));
|
|
165
|
+
const payload = errorPayload(usageError);
|
|
166
|
+
if (requestedJson) {
|
|
167
|
+
writeLine(stdout, JSON.stringify({ error: payload }));
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
writeLine(stderr, `${payload.message}`);
|
|
171
|
+
writeLine(stderr, 'Run `jovie --help` for usage.');
|
|
172
|
+
}
|
|
173
|
+
return 2;
|
|
174
|
+
}
|
|
175
|
+
const { values, positionals } = parsed;
|
|
176
|
+
if (values.version) {
|
|
177
|
+
writeLine(stdout, CLI_VERSION);
|
|
178
|
+
return 0;
|
|
179
|
+
}
|
|
180
|
+
if (values.help || positionals.length === 0) {
|
|
181
|
+
writeText(stdout, usage());
|
|
182
|
+
return 0;
|
|
183
|
+
}
|
|
184
|
+
if (positionals.length === 1 && positionals[0] === 'mcp') {
|
|
185
|
+
try {
|
|
186
|
+
await serveMcp((dependencies.stdin ?? process.stdin), stdout, {
|
|
187
|
+
version: CLI_VERSION,
|
|
188
|
+
baseUrl: normalizeBaseUrl(values.baseUrl),
|
|
189
|
+
fetchImpl: dependencies.fetchImpl,
|
|
190
|
+
});
|
|
191
|
+
return 0;
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
writeLine(stderr, errorPayload(error).message);
|
|
195
|
+
return 2;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
const result = await execute(positionals, values, dependencies);
|
|
200
|
+
if (typeof result === 'string') {
|
|
201
|
+
if (values.json) {
|
|
202
|
+
writeLine(stdout, JSON.stringify({ content: result }));
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
writeText(stdout, result);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
writeLine(stdout, JSON.stringify(result, null, values.json ? 0 : 2));
|
|
210
|
+
}
|
|
211
|
+
return 0;
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
const payload = errorPayload(error);
|
|
215
|
+
if (requestedJson || values.json) {
|
|
216
|
+
writeLine(stdout, JSON.stringify({ error: payload }));
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
writeLine(stderr, payload.message);
|
|
220
|
+
}
|
|
221
|
+
return error instanceof UsageError || error instanceof JovieInputError
|
|
222
|
+
? 2
|
|
223
|
+
: 1;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const isMain = process.argv[1] !== undefined &&
|
|
227
|
+
realpathSync(fileURLToPath(import.meta.url)) ===
|
|
228
|
+
realpathSync(resolve(process.argv[1]));
|
|
229
|
+
if (isMain) {
|
|
230
|
+
runCli(process.argv.slice(2)).then(code => {
|
|
231
|
+
process.exitCode = code;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],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,CAAC;QAC/C,CAAC;QACD,OAAO,KAAK,YAAY,UAAU,IAAI,KAAK,YAAY,eAAe;YACpE,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;AACH,CAAC;AAED,MAAM,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;IAC7B,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1C,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3C,IAAI,MAAM,EAAE,CAAC;IACX,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACxC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const DEFAULT_BASE_URL = "https://jov.ie";
|
|
2
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
3
|
+
export declare const DEFAULT_USER_AGENT = "jovie-cli";
|
|
4
|
+
export type FetchImplementation = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
5
|
+
export type ResourceOptions = {
|
|
6
|
+
readonly baseUrl?: string;
|
|
7
|
+
readonly fetchImpl?: FetchImplementation;
|
|
8
|
+
readonly signal?: AbortSignal;
|
|
9
|
+
readonly timeoutMs?: number;
|
|
10
|
+
readonly userAgent?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class JovieInputError extends Error {
|
|
13
|
+
readonly code: "INVALID_INPUT";
|
|
14
|
+
constructor(message: string);
|
|
15
|
+
}
|
|
16
|
+
export declare class JovieRequestError extends Error {
|
|
17
|
+
readonly url: string;
|
|
18
|
+
readonly status?: number | undefined;
|
|
19
|
+
readonly responseBody?: string | undefined;
|
|
20
|
+
readonly retryAfterSeconds?: number | undefined;
|
|
21
|
+
/** Stable server error code (e.g. RATE_LIMITED) when the API sent one. */
|
|
22
|
+
readonly apiCode?: string | undefined;
|
|
23
|
+
readonly code: "REQUEST_FAILED";
|
|
24
|
+
constructor(message: string, url: string, status?: number | undefined, responseBody?: string | undefined, retryAfterSeconds?: number | undefined,
|
|
25
|
+
/** Stable server error code (e.g. RATE_LIMITED) when the API sent one. */
|
|
26
|
+
apiCode?: string | undefined);
|
|
27
|
+
}
|
|
28
|
+
/** Normalize a deployment root without accepting credentials or query state. */
|
|
29
|
+
export declare function normalizeBaseUrl(baseUrl?: string): string;
|
|
30
|
+
export declare function validateUsername(username: string): string;
|
|
31
|
+
/** Fetch the public, unauthenticated artist API response. */
|
|
32
|
+
export declare function fetchArtist(username: string, options?: ResourceOptions): Promise<unknown>;
|
|
33
|
+
/** Fetch the canonical public OpenAPI 3.1 contract. */
|
|
34
|
+
export declare function fetchOpenApi(options?: ResourceOptions): Promise<unknown>;
|
|
35
|
+
/** Fetch the site-level machine-readable agent guide. */
|
|
36
|
+
export declare function fetchSiteLlms(full: boolean, options?: ResourceOptions): Promise<string>;
|
|
37
|
+
/** Fetch the machine-readable guide for one public artist. */
|
|
38
|
+
export declare function fetchArtistLlms(username: string, options?: ResourceOptions): Promise<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Create (or find) a Jovie profile for a Spotify artist. Returns the public
|
|
41
|
+
* profile URL and, when unclaimed, a claim URL the human opens to verify
|
|
42
|
+
* ownership. Anonymous and rate limited per IP.
|
|
43
|
+
*/
|
|
44
|
+
export declare function createProfile(spotifyArtistUrl: string, options?: ResourceOptions): Promise<unknown>;
|
|
45
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AACjD,e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