@shuffl/cli 0.6.0 → 0.6.2

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
@@ -71,3 +71,7 @@ shuffl logout --company
71
71
  Or set `SHUFFL_COMPANY_KEY` and `SHUFFL_BASE_URL`. The company key is saved in `company.json` next to `config.json`, and only `shuffl company` commands send it; `shuffl logout --company` removes it. Each command's `--help` names its company permission. See [company keys](https://shuffl-rebuild.vercel.app/docs/api-permissions#company-keys).
72
72
 
73
73
  Full guide: [Use the Shuffl CLI](https://shuffl-rebuild.vercel.app/docs/cli).
74
+
75
+ ## License
76
+
77
+ MIT © Shuffl LLC. See [LICENSE](./LICENSE).
package/dist/index.js CHANGED
@@ -7,6 +7,8 @@ import { ORPCError, Shuffl } from '@shuffl/sdk';
7
7
  import { commands } from './commands.generated.js';
8
8
  // package.json sits one level above both src/ and dist/.
9
9
  const { version } = createRequire(import.meta.url)('../package.json');
10
+ // Sent ahead of the SDK's own in x-shuffl-client, so Shuffl counts CLI use.
11
+ const cliClient = `shuffl-cli/${version}`;
10
12
  async function request(run) {
11
13
  try {
12
14
  return await run();
@@ -109,7 +111,7 @@ export async function runCli(args, io = {
109
111
  const configDirectory = io.env.SHUFFL_CONFIG_DIR ??
110
112
  join(io.env.XDG_CONFIG_HOME ?? join(homedir(), '.config'), 'shuffl');
111
113
  const configFile = join(configDirectory, 'config.json');
112
- // #1692: a company key is saved apart from the workspace key, and only
114
+ // A company key is saved apart from the workspace key, and only
113
115
  // `shuffl company` commands send it.
114
116
  const companyFile = join(configDirectory, 'company.json');
115
117
  if (flags.version && !positional.length) {
@@ -144,7 +146,11 @@ export async function runCli(args, io = {
144
146
  if (!/^shuffl_company_[A-Za-z0-9_-]{43}$/.test(token))
145
147
  throw new Error('Expected a Shuffl company key.');
146
148
  const baseUrl = new URL(flags['base-url']).origin;
147
- const company = await request(() => new Shuffl({ apiKey: token, baseUrl }).company.current());
149
+ const company = await request(() => new Shuffl({
150
+ apiKey: token,
151
+ baseUrl,
152
+ client: cliClient,
153
+ }).company.current());
148
154
  await save(companyFile, { baseUrl, token });
149
155
  io.stdout(json
150
156
  ? JSON.stringify({ company }) + '\n'
@@ -157,6 +163,7 @@ export async function runCli(args, io = {
157
163
  const client = new Shuffl({
158
164
  apiKey: token,
159
165
  baseUrl,
166
+ client: cliClient,
160
167
  });
161
168
  const team = await request(() => client.teams.current());
162
169
  await save(configFile, { baseUrl, token });
@@ -211,8 +218,8 @@ export async function runCli(args, io = {
211
218
  new URL(baseUrl).origin !== new URL(saved.baseUrl).origin)
212
219
  throw new Error('Saved credentials belong to a different server. Sign in to the target server first.');
213
220
  let method = company
214
- ? new Shuffl({ apiKey: token, baseUrl }).company
215
- : new Shuffl({ apiKey: token, baseUrl });
221
+ ? new Shuffl({ apiKey: token, baseUrl, client: cliClient }).company
222
+ : new Shuffl({ apiKey: token, baseUrl, client: cliClient });
216
223
  for (const name of command.path)
217
224
  method = method[name];
218
225
  const output = await request(() => method(input));
package/dist/types.d.ts CHANGED
@@ -13,6 +13,6 @@ export interface CommandDefinition {
13
13
  summary: string;
14
14
  scope: string | null;
15
15
  input: JsonSchema | null;
16
- /** company: a company key command, under `shuffl company` (#1692). */
16
+ /** company: a company key command, under `shuffl company`. */
17
17
  credential?: 'company';
18
18
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "@orpc/client": "1.15.3",
4
- "@shuffl/api-contracts": "0.6.0",
5
- "@shuffl/sdk": "0.6.0"
4
+ "@shuffl/api-contracts": "0.6.2",
5
+ "@shuffl/sdk": "0.6.2"
6
6
  },
7
7
  "description": "Shuffl command line: every public API operation as a scriptable command with JSON output.",
8
8
  "engines": {
@@ -33,7 +33,7 @@
33
33
  "sideEffects": false,
34
34
  "type": "module",
35
35
  "types": "./dist/index.d.ts",
36
- "version": "0.6.0",
36
+ "version": "0.6.2",
37
37
  "bin": {
38
38
  "shuffl": "./dist/bin.js"
39
39
  }