@countfinancial/cli 0.1.8 → 0.2.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/LICENSE +15 -0
- package/README.md +9 -1
- package/dist/__tests__/credentialStore.test.js +9 -0
- package/dist/__tests__/credentialStore.test.js.map +1 -1
- package/dist/__tests__/doctor.test.d.ts +1 -0
- package/dist/__tests__/doctor.test.js +30 -0
- package/dist/__tests__/doctor.test.js.map +1 -0
- package/dist/__tests__/mcpInstall.test.d.ts +1 -0
- package/dist/__tests__/mcpInstall.test.js +25 -0
- package/dist/__tests__/mcpInstall.test.js.map +1 -0
- package/dist/__tests__/profileStore.test.d.ts +1 -0
- package/dist/__tests__/profileStore.test.js +53 -0
- package/dist/__tests__/profileStore.test.js.map +1 -0
- package/dist/cli.js +122 -9
- package/dist/cli.js.map +1 -1
- package/dist/commands/doctor.command.d.ts +6 -0
- package/dist/commands/doctor.command.js +12 -0
- package/dist/commands/doctor.command.js.map +1 -0
- package/dist/commands/init.command.d.ts +1 -0
- package/dist/commands/init.command.js +6 -1
- package/dist/commands/init.command.js.map +1 -1
- package/dist/commands/login.command.d.ts +1 -0
- package/dist/commands/login.command.js +3 -3
- package/dist/commands/login.command.js.map +1 -1
- package/dist/commands/logout.command.d.ts +5 -1
- package/dist/commands/logout.command.js +3 -3
- package/dist/commands/logout.command.js.map +1 -1
- package/dist/commands/mcp.command.d.ts +5 -1
- package/dist/commands/mcp.command.js +7 -4
- package/dist/commands/mcp.command.js.map +1 -1
- package/dist/commands/mcpInstall.command.d.ts +7 -0
- package/dist/commands/mcpInstall.command.js +9 -0
- package/dist/commands/mcpInstall.command.js.map +1 -0
- package/dist/commands/profiles.command.d.ts +17 -0
- package/dist/commands/profiles.command.js +48 -0
- package/dist/commands/profiles.command.js.map +1 -0
- package/dist/commands/setup.command.d.ts +11 -0
- package/dist/commands/setup.command.js +85 -0
- package/dist/commands/setup.command.js.map +1 -0
- package/dist/commands/status.command.d.ts +6 -1
- package/dist/commands/status.command.js +7 -4
- package/dist/commands/status.command.js.map +1 -1
- package/dist/commands/testTools.command.d.ts +7 -0
- package/dist/commands/testTools.command.js +42 -0
- package/dist/commands/testTools.command.js.map +1 -0
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/helpers/toolSmokeTestFixtures.helper.d.ts +16 -0
- package/dist/helpers/toolSmokeTestFixtures.helper.js +491 -0
- package/dist/helpers/toolSmokeTestFixtures.helper.js.map +1 -0
- package/dist/partner-mcp/helpers/mcpKnowledge.helper.js +114 -4
- package/dist/partner-mcp/helpers/mcpKnowledge.helper.js.map +1 -1
- package/dist/partner-mcp/helpers/mcpPayloadValidation.helper.d.ts +1 -1
- package/dist/partner-mcp/helpers/mcpPayloadValidation.helper.js +61 -84
- package/dist/partner-mcp/helpers/mcpPayloadValidation.helper.js.map +1 -1
- package/dist/partner-mcp/helpers/mcpPlaybooks.helper.js +181 -2
- package/dist/partner-mcp/helpers/mcpPlaybooks.helper.js.map +1 -1
- package/dist/partner-mcp/helpers/mcpRecoveryHint.helper.js +79 -0
- package/dist/partner-mcp/helpers/mcpRecoveryHint.helper.js.map +1 -1
- package/dist/partner-mcp/schemas/bodies.d.ts +528 -0
- package/dist/partner-mcp/schemas/bodies.js +377 -0
- package/dist/partner-mcp/schemas/bodies.js.map +1 -0
- package/dist/partner-mcp/schemas/builders.d.ts +36 -0
- package/dist/partner-mcp/schemas/builders.js +106 -0
- package/dist/partner-mcp/schemas/builders.js.map +1 -0
- package/dist/partner-mcp/schemas/index.d.ts +5 -0
- package/dist/partner-mcp/schemas/index.js +6 -0
- package/dist/partner-mcp/schemas/index.js.map +1 -0
- package/dist/partner-mcp/schemas/primitives.d.ts +39 -0
- package/dist/partner-mcp/schemas/primitives.js +107 -0
- package/dist/partner-mcp/schemas/primitives.js.map +1 -0
- package/dist/partner-mcp/schemas/queries.d.ts +311 -0
- package/dist/partner-mcp/schemas/queries.js +175 -0
- package/dist/partner-mcp/schemas/queries.js.map +1 -0
- package/dist/partner-mcp/schemas/toolInputSchemas.d.ts +23 -0
- package/dist/partner-mcp/schemas/toolInputSchemas.js +248 -0
- package/dist/partner-mcp/schemas/toolInputSchemas.js.map +1 -0
- package/dist/partner-mcp/tools/definitions.js +26 -135
- package/dist/partner-mcp/tools/definitions.js.map +1 -1
- package/dist/partner-mcp/tools/registerTools.d.ts +8 -0
- package/dist/partner-mcp/tools/registerTools.js +8 -3
- package/dist/partner-mcp/tools/registerTools.js.map +1 -1
- package/dist/services/credentialStore.service.d.ts +8 -2
- package/dist/services/credentialStore.service.js +22 -10
- package/dist/services/credentialStore.service.js.map +1 -1
- package/dist/services/doctor.service.d.ts +22 -0
- package/dist/services/doctor.service.js +186 -0
- package/dist/services/doctor.service.js.map +1 -0
- package/dist/services/mcpInstall.service.d.ts +43 -0
- package/dist/services/mcpInstall.service.js +117 -0
- package/dist/services/mcpInstall.service.js.map +1 -0
- package/dist/services/mcpLauncher.service.d.ts +2 -0
- package/dist/services/mcpLauncher.service.js +6 -3
- package/dist/services/mcpLauncher.service.js.map +1 -1
- package/dist/services/profileStore.service.d.ts +53 -0
- package/dist/services/profileStore.service.js +129 -0
- package/dist/services/profileStore.service.js.map +1 -0
- package/dist/services/setupPrompt.service.d.ts +25 -0
- package/dist/services/setupPrompt.service.js +40 -0
- package/dist/services/setupPrompt.service.js.map +1 -0
- package/dist/services/toolSmokeTest.service.d.ts +38 -0
- package/dist/services/toolSmokeTest.service.js +495 -0
- package/dist/services/toolSmokeTest.service.js.map +1 -0
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) COUNT Financial
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -52,12 +52,20 @@ count mcp print-config
|
|
|
52
52
|
|
|
53
53
|
| Command | Description |
|
|
54
54
|
| --- | --- |
|
|
55
|
+
| `count setup` | Interactive wizard: credentials, login, MCP install, health checks |
|
|
56
|
+
| `count doctor` | Run CLI/API health checks |
|
|
55
57
|
| `count init` | Save `client_id` / `client_secret` |
|
|
56
58
|
| `count login` | Browser OAuth login + token storage |
|
|
57
|
-
| `count logout` | Delete
|
|
59
|
+
| `count logout` | Delete stored credentials for the active profile |
|
|
58
60
|
| `count status` | Show whether credentials/tokens are present |
|
|
61
|
+
| `count profiles list` | List named credential profiles |
|
|
62
|
+
| `count profiles add <name>` | Create a profile with partner credentials |
|
|
63
|
+
| `count profiles use <name>` | Switch the active profile |
|
|
59
64
|
| `count mcp` | Start the local COUNT Partner MCP stdio server |
|
|
60
65
|
| `count mcp print-config` | Emit MCP JSON for Claude Code / Cursor |
|
|
66
|
+
| `count mcp install` | Write MCP config into Cursor or Claude settings |
|
|
67
|
+
|
|
68
|
+
Use `--profile <name>` on any command to target a named profile under `~/.count/profiles/`.
|
|
61
69
|
|
|
62
70
|
## Environment
|
|
63
71
|
|
|
@@ -4,7 +4,16 @@ import os from 'node:os';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { describe, it } from 'node:test';
|
|
6
6
|
import { buildDefaultCredentials, deleteCredentials, getConfigFilePath, loadCredentials, saveCredentials, } from '../services/credentialStore.service.js';
|
|
7
|
+
import { DEFAULT_API_BASE_URL } from '../constants.js';
|
|
7
8
|
describe('credentialStore', () => {
|
|
9
|
+
it('defaults to the production API host when no api URL is provided', () => {
|
|
10
|
+
const credentials = buildDefaultCredentials({
|
|
11
|
+
clientId: 'client-id',
|
|
12
|
+
clientSecret: 'client-secret',
|
|
13
|
+
});
|
|
14
|
+
assert.equal(credentials.apiBaseUrl, DEFAULT_API_BASE_URL);
|
|
15
|
+
assert.equal(credentials.apiBaseUrl, 'https://api.getcount.com');
|
|
16
|
+
});
|
|
8
17
|
it('saves and reloads credentials with restricted file permissions', async () => {
|
|
9
18
|
const temporaryHomeDirectory = await fs.mkdtemp(path.join(os.tmpdir(), 'count-cli-home-'));
|
|
10
19
|
const configFilePath = getConfigFilePath({ homeDirectory: temporaryHomeDirectory });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentialStore.test.js","sourceRoot":"","sources":["../../src/__tests__/credentialStore.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"credentialStore.test.js","sourceRoot":"","sources":["../../src/__tests__/credentialStore.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,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,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEhD,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,sBAAsB,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC;QAC3F,MAAM,cAAc,GAAG,iBAAiB,CAAC,EAAE,aAAa,EAAE,sBAAsB,EAAE,CAAC,CAAC;QACpF,MAAM,WAAW,GAAG,uBAAuB,CAAC;YAC1C,QAAQ,EAAE,WAAW;YACrB,YAAY,EAAE,eAAe;SAC9B,CAAC,CAAC;QAEH,MAAM,eAAe,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;QACvD,MAAM,iBAAiB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QAE5C,MAAM,mBAAmB,GAAG,MAAM,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QACtE,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
3
|
+
import { formatDoctorReport, runDoctorChecks } from '../services/doctor.service.js';
|
|
4
|
+
import { buildDefaultCredentials, saveCredentials } from '../services/credentialStore.service.js';
|
|
5
|
+
import fs from 'node:fs/promises';
|
|
6
|
+
import os from 'node:os';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { getLegacyCredentialsFilePath } from '../services/profileStore.service.js';
|
|
9
|
+
describe('doctor', () => {
|
|
10
|
+
it('reports missing login tokens when credentials are not authenticated', async () => {
|
|
11
|
+
const temporaryHomeDirectory = await fs.mkdtemp(path.join(os.tmpdir(), 'count-cli-doctor-home-'));
|
|
12
|
+
const legacyCredentialsFilePath = getLegacyCredentialsFilePath({ homeDirectory: temporaryHomeDirectory });
|
|
13
|
+
await saveCredentials({
|
|
14
|
+
credentials: buildDefaultCredentials({
|
|
15
|
+
clientId: 'client-id',
|
|
16
|
+
clientSecret: 'client-secret',
|
|
17
|
+
}),
|
|
18
|
+
configFilePath: legacyCredentialsFilePath,
|
|
19
|
+
});
|
|
20
|
+
const doctorResult = await runDoctorChecks({
|
|
21
|
+
homeDirectory: temporaryHomeDirectory,
|
|
22
|
+
fetchImplementation: async () => new Response(null, { status: 200 }),
|
|
23
|
+
});
|
|
24
|
+
const loginCheck = doctorResult.checks.find((_check) => _check.checkId === 'login_tokens');
|
|
25
|
+
assert.ok(loginCheck);
|
|
26
|
+
assert.equal(loginCheck?.status, 'fail');
|
|
27
|
+
assert.match(formatDoctorReport({ result: doctorResult }), /One or more checks failed/);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=doctor.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.test.js","sourceRoot":"","sources":["../../src/__tests__/doctor.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAClG,OAAO,EAAE,MAAM,kBAAkB,CA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@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
3
|
+
import { mergeCountMcpServerConfig } from '../services/mcpInstall.service.js';
|
|
4
|
+
describe('mcpInstall', () => {
|
|
5
|
+
it('merges the COUNT MCP server without removing other servers', () => {
|
|
6
|
+
const mergedConfiguration = mergeCountMcpServerConfig({
|
|
7
|
+
existingConfiguration: {
|
|
8
|
+
mcpServers: {
|
|
9
|
+
other: {
|
|
10
|
+
command: 'node',
|
|
11
|
+
args: ['other-server.js'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
countServerConfiguration: {
|
|
16
|
+
command: '/usr/local/bin/node',
|
|
17
|
+
args: ['/path/to/count-cli/dist/index.js', 'mcp'],
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const mcpServers = mergedConfiguration.mcpServers;
|
|
21
|
+
assert.deepEqual(mcpServers.other.args, ['other-server.js']);
|
|
22
|
+
assert.deepEqual(mcpServers.count.args, ['/path/to/count-cli/dist/index.js', 'mcp']);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=mcpInstall.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpInstall.test.js","sourceRoot":"","sources":["../../src/__tests__/mcpInstall.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;YACpD,qBAAqB,EAAE;gBACrB,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,OAAO,EAAE,MAAM;wBACf,IAAI,EAAE,CAAC,iBAAiB,CAAC;qBAC1B;iBACF;aACF;YACD,wBAAwB,EAAE;gBACxB,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAE,CAAC,kCAAkC,EAAE,KAAK,CAAC;aAClD;SACF,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,mBAAmB,CAAC,UAAqD,CAAC;QAC7F,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAC7D,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { describe, it } from 'node:test';
|
|
6
|
+
import { DEFAULT_PROFILE_NAME, getLegacyCredentialsFilePath, getProfileCredentialsFilePath, listProfileNames, migrateLegacyCredentialsToProfile, resolveCredentialsFilePath, setActiveProfileName, } from '../services/profileStore.service.js';
|
|
7
|
+
import { buildDefaultCredentials, loadCredentials, saveCredentials } from '../services/credentialStore.service.js';
|
|
8
|
+
describe('profileStore', () => {
|
|
9
|
+
it('uses legacy credentials path until profile mode is activated', async () => {
|
|
10
|
+
const temporaryHomeDirectory = await fs.mkdtemp(path.join(os.tmpdir(), 'count-cli-profile-home-'));
|
|
11
|
+
const legacyCredentialsFilePath = getLegacyCredentialsFilePath({ homeDirectory: temporaryHomeDirectory });
|
|
12
|
+
assert.equal(resolveCredentialsFilePath({ homeDirectory: temporaryHomeDirectory }), legacyCredentialsFilePath);
|
|
13
|
+
});
|
|
14
|
+
it('switches to profile credentials after active profile is set', async () => {
|
|
15
|
+
const temporaryHomeDirectory = await fs.mkdtemp(path.join(os.tmpdir(), 'count-cli-profile-home-'));
|
|
16
|
+
const profileName = 'acme-corp';
|
|
17
|
+
const profileCredentialsFilePath = getProfileCredentialsFilePath({
|
|
18
|
+
profileName,
|
|
19
|
+
homeDirectory: temporaryHomeDirectory,
|
|
20
|
+
});
|
|
21
|
+
await setActiveProfileName({ profileName, homeDirectory: temporaryHomeDirectory });
|
|
22
|
+
await saveCredentials({
|
|
23
|
+
credentials: buildDefaultCredentials({
|
|
24
|
+
clientId: 'client-id',
|
|
25
|
+
clientSecret: 'client-secret',
|
|
26
|
+
}),
|
|
27
|
+
configFilePath: profileCredentialsFilePath,
|
|
28
|
+
});
|
|
29
|
+
assert.equal(resolveCredentialsFilePath({ homeDirectory: temporaryHomeDirectory }), profileCredentialsFilePath);
|
|
30
|
+
const profileNames = await listProfileNames({ homeDirectory: temporaryHomeDirectory });
|
|
31
|
+
assert.deepEqual(profileNames, [profileName]);
|
|
32
|
+
});
|
|
33
|
+
it('migrates legacy credentials into a named profile', async () => {
|
|
34
|
+
const temporaryHomeDirectory = await fs.mkdtemp(path.join(os.tmpdir(), 'count-cli-profile-home-'));
|
|
35
|
+
const legacyCredentialsFilePath = getLegacyCredentialsFilePath({ homeDirectory: temporaryHomeDirectory });
|
|
36
|
+
const credentials = buildDefaultCredentials({
|
|
37
|
+
clientId: 'legacy-client-id',
|
|
38
|
+
clientSecret: 'legacy-client-secret',
|
|
39
|
+
});
|
|
40
|
+
await saveCredentials({ credentials, configFilePath: legacyCredentialsFilePath });
|
|
41
|
+
const migrated = await migrateLegacyCredentialsToProfile({
|
|
42
|
+
profileName: DEFAULT_PROFILE_NAME,
|
|
43
|
+
homeDirectory: temporaryHomeDirectory,
|
|
44
|
+
});
|
|
45
|
+
assert.equal(migrated, true);
|
|
46
|
+
const reloadedCredentials = await loadCredentials({
|
|
47
|
+
profileName: DEFAULT_PROFILE_NAME,
|
|
48
|
+
homeDirectory: temporaryHomeDirectory,
|
|
49
|
+
});
|
|
50
|
+
assert.equal(reloadedCredentials?.clientId, 'legacy-client-id');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=profileStore.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileStore.test.js","sourceRoot":"","sources":["../../src/__tests__/profileStore.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,6BAA6B,EAC7B,gBAAgB,EAChB,iCAAiC,EACjC,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAEnH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,8DAA8D,EAAE,KAAK,IAAI,EAAE;QAC5E,MAAM,sBAAsB,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,yBAAyB,CAAC,CAAC,CAAC;QACnG,MAAM,yBAAyB,GAAG,4BAA4B,CAAC,EAAE,aAAa,EAAE,sBAAsB,EAAE,CAAC,CAAC;QAE1G,MAAM,CAAC,KAAK,CACV,0BAA0B,CAAC,EAAE,aAAa,EAAE,sBAAsB,EAAE,CAAC,EACrE,yBAAyB,CAC1B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EA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AAM,eAAe,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,yBAAyB,EAAE,CAAC,CAAC;QAClF,MAAM,QAAQ,GAAG,MAAM,iCAAiC,CAAC;YACvD,WAAW,EAAE,oBAAoB;YACjC,aAAa,EAAE,sBAAsB;SACtC,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC7B,MAAM,mBAAmB,GAAG,MAAM,eAAe,CAAC;YAChD,WAAW,EAAE,oBAAoB;YACjC,aAAa,EAAE,sBAAsB;SACtC,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -2,25 +2,88 @@ import { Command } from 'commander';
|
|
|
2
2
|
import { runInitCommand } from './commands/init.command.js';
|
|
3
3
|
import { runLoginCommand } from './commands/login.command.js';
|
|
4
4
|
import { runLogoutCommand } from './commands/logout.command.js';
|
|
5
|
+
import { runDoctorCommand } from './commands/doctor.command.js';
|
|
6
|
+
import { runTestToolsCommand } from './commands/testTools.command.js';
|
|
7
|
+
import { runMcpInstallCommand } from './commands/mcpInstall.command.js';
|
|
5
8
|
import { runMcpPrintConfigCommand, runMcpStartCommand } from './commands/mcp.command.js';
|
|
9
|
+
import { runProfilesAddCommand, runProfilesListCommand, runProfilesUseCommand, } from './commands/profiles.command.js';
|
|
10
|
+
import { runSetupCommand } from './commands/setup.command.js';
|
|
6
11
|
import { runStatusCommand } from './commands/status.command.js';
|
|
12
|
+
function readGlobalOptions(command) {
|
|
13
|
+
let rootCommand = command;
|
|
14
|
+
while (rootCommand.parent) {
|
|
15
|
+
rootCommand = rootCommand.parent;
|
|
16
|
+
}
|
|
17
|
+
return rootCommand.opts();
|
|
18
|
+
}
|
|
7
19
|
export function createCli(params) {
|
|
8
20
|
const program = new Command();
|
|
9
21
|
program
|
|
10
22
|
.name('count')
|
|
11
23
|
.description('COUNT Partner CLI — OAuth login and local MCP for Claude Code, Cursor, and agents.')
|
|
12
|
-
.version(params.version)
|
|
24
|
+
.version(params.version)
|
|
25
|
+
.option('--profile <profileName>', 'Named credential profile under ~/.count/profiles/')
|
|
26
|
+
.option('--json', 'Emit machine-readable JSON output where supported');
|
|
27
|
+
program
|
|
28
|
+
.command('setup')
|
|
29
|
+
.description('Interactive setup wizard: credentials, login, MCP install, and health checks')
|
|
30
|
+
.option('--profile <profileName>', 'Profile name to create or update', 'default')
|
|
31
|
+
.option('--client-id <clientId>', 'Partner client ID (non-interactive mode)')
|
|
32
|
+
.option('--client-secret <clientSecret>', 'Partner client secret (non-interactive mode)')
|
|
33
|
+
.option('--api-url <apiUrl>', 'COUNT API base URL')
|
|
34
|
+
.option('--skip-login', 'Skip browser OAuth login')
|
|
35
|
+
.option('--skip-install', 'Skip MCP editor config install')
|
|
36
|
+
.option('--non-interactive', 'Run without prompts (requires client credentials flags when needed)')
|
|
37
|
+
.action(async (options, command) => {
|
|
38
|
+
const globalOptions = readGlobalOptions(command);
|
|
39
|
+
const exitCode = await runSetupCommand({
|
|
40
|
+
profileName: options.profile ?? globalOptions.profile,
|
|
41
|
+
clientId: options.clientId,
|
|
42
|
+
clientSecret: options.clientSecret,
|
|
43
|
+
apiBaseUrl: options.apiUrl,
|
|
44
|
+
skipLogin: options.skipLogin,
|
|
45
|
+
skipInstall: options.skipInstall,
|
|
46
|
+
nonInteractive: options.nonInteractive,
|
|
47
|
+
});
|
|
48
|
+
process.exit(exitCode);
|
|
49
|
+
});
|
|
50
|
+
program
|
|
51
|
+
.command('doctor')
|
|
52
|
+
.description('Run COUNT CLI and API health checks')
|
|
53
|
+
.action(async (_options, command) => {
|
|
54
|
+
const globalOptions = readGlobalOptions(command);
|
|
55
|
+
const exitCode = await runDoctorCommand({
|
|
56
|
+
profileName: globalOptions.profile,
|
|
57
|
+
json: globalOptions.json,
|
|
58
|
+
});
|
|
59
|
+
process.exit(exitCode);
|
|
60
|
+
});
|
|
61
|
+
program
|
|
62
|
+
.command('test-tools')
|
|
63
|
+
.description('Smoke-test all COUNT MCP tools and write an HTML report')
|
|
64
|
+
.option('--html <outputPath>', 'HTML report output path', 'count-cli-test-report.html')
|
|
65
|
+
.action(async (options, command) => {
|
|
66
|
+
const globalOptions = readGlobalOptions(command);
|
|
67
|
+
const exitCode = await runTestToolsCommand({
|
|
68
|
+
profileName: globalOptions.profile,
|
|
69
|
+
htmlOutputPath: options.html,
|
|
70
|
+
json: globalOptions.json,
|
|
71
|
+
});
|
|
72
|
+
process.exit(exitCode);
|
|
73
|
+
});
|
|
13
74
|
program
|
|
14
75
|
.command('init')
|
|
15
76
|
.description('Save partner client credentials from COUNT Partners')
|
|
16
77
|
.requiredOption('--client-id <clientId>', 'Partner client ID')
|
|
17
78
|
.requiredOption('--client-secret <clientSecret>', 'Partner client secret')
|
|
18
79
|
.option('--api-url <apiUrl>', 'COUNT API base URL (default: prod, or keep existing saved URL)')
|
|
19
|
-
.action(async (options) => {
|
|
80
|
+
.action(async (options, command) => {
|
|
81
|
+
const globalOptions = readGlobalOptions(command);
|
|
20
82
|
await runInitCommand({
|
|
21
83
|
clientId: options.clientId,
|
|
22
84
|
clientSecret: options.clientSecret,
|
|
23
85
|
apiBaseUrl: options.apiUrl,
|
|
86
|
+
profileName: globalOptions.profile,
|
|
24
87
|
});
|
|
25
88
|
});
|
|
26
89
|
program
|
|
@@ -28,24 +91,63 @@ export function createCli(params) {
|
|
|
28
91
|
.description('Sign in through COUNT partner OAuth and store workspace tokens')
|
|
29
92
|
.option('--port <port>', 'Local OAuth callback port', (value) => Number.parseInt(value, 10))
|
|
30
93
|
.option('--no-open', 'Print the sign-in URL instead of opening a browser')
|
|
31
|
-
.action(async (options) => {
|
|
94
|
+
.action(async (options, command) => {
|
|
95
|
+
const globalOptions = readGlobalOptions(command);
|
|
32
96
|
await runLoginCommand({
|
|
33
97
|
callbackPort: options.port,
|
|
34
98
|
openBrowserAutomatically: options.open,
|
|
99
|
+
profileName: globalOptions.profile,
|
|
35
100
|
});
|
|
36
101
|
});
|
|
37
|
-
program.command('logout').description('Remove stored COUNT CLI credentials').action(async () => {
|
|
38
|
-
|
|
102
|
+
program.command('logout').description('Remove stored COUNT CLI credentials').action(async (_options, command) => {
|
|
103
|
+
const globalOptions = readGlobalOptions(command);
|
|
104
|
+
await runLogoutCommand({ profileName: globalOptions.profile });
|
|
39
105
|
});
|
|
40
|
-
program.command('status').description('Show stored credential state').action(async () => {
|
|
41
|
-
|
|
106
|
+
program.command('status').description('Show stored credential state').action(async (_options, command) => {
|
|
107
|
+
const globalOptions = readGlobalOptions(command);
|
|
108
|
+
await runStatusCommand({
|
|
109
|
+
profileName: globalOptions.profile,
|
|
110
|
+
json: globalOptions.json,
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
const profilesCommand = program.command('profiles').description('Manage named credential profiles');
|
|
114
|
+
profilesCommand
|
|
115
|
+
.command('list')
|
|
116
|
+
.description('List saved credential profiles')
|
|
117
|
+
.action(async (_options, command) => {
|
|
118
|
+
const globalOptions = readGlobalOptions(command);
|
|
119
|
+
await runProfilesListCommand({
|
|
120
|
+
profileName: globalOptions.profile,
|
|
121
|
+
json: globalOptions.json,
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
profilesCommand
|
|
125
|
+
.command('add <profileName>')
|
|
126
|
+
.description('Create a profile and save partner client credentials')
|
|
127
|
+
.requiredOption('--client-id <clientId>', 'Partner client ID')
|
|
128
|
+
.requiredOption('--client-secret <clientSecret>', 'Partner client secret')
|
|
129
|
+
.option('--api-url <apiUrl>', 'COUNT API base URL')
|
|
130
|
+
.action(async (profileName, options) => {
|
|
131
|
+
await runProfilesAddCommand({
|
|
132
|
+
profileName,
|
|
133
|
+
clientId: options.clientId,
|
|
134
|
+
clientSecret: options.clientSecret,
|
|
135
|
+
apiBaseUrl: options.apiUrl,
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
profilesCommand
|
|
139
|
+
.command('use <profileName>')
|
|
140
|
+
.description('Switch the active credential profile')
|
|
141
|
+
.action(async (profileName) => {
|
|
142
|
+
await runProfilesUseCommand({ profileName });
|
|
42
143
|
});
|
|
43
144
|
const mcpCommand = program.command('mcp').description('Local COUNT Partner MCP server');
|
|
44
145
|
mcpCommand
|
|
45
146
|
.command('start', { isDefault: true })
|
|
46
147
|
.description('Start the stdio MCP server using stored credentials')
|
|
47
|
-
.action(async () => {
|
|
48
|
-
|
|
148
|
+
.action(async (_options, command) => {
|
|
149
|
+
const globalOptions = readGlobalOptions(command);
|
|
150
|
+
await runMcpStartCommand({ profileName: globalOptions.profile });
|
|
49
151
|
});
|
|
50
152
|
mcpCommand
|
|
51
153
|
.command('print-config')
|
|
@@ -53,6 +155,17 @@ export function createCli(params) {
|
|
|
53
155
|
.action(async () => {
|
|
54
156
|
await runMcpPrintConfigCommand();
|
|
55
157
|
});
|
|
158
|
+
mcpCommand
|
|
159
|
+
.command('install')
|
|
160
|
+
.description('Install COUNT MCP config into Cursor or Claude settings')
|
|
161
|
+
.option('--target <target>', 'Install target: cursor, claude-code, claude-desktop, or all', 'cursor')
|
|
162
|
+
.option('--dry-run', 'Show what would be written without modifying files')
|
|
163
|
+
.action(async (options) => {
|
|
164
|
+
await runMcpInstallCommand({
|
|
165
|
+
target: options.target,
|
|
166
|
+
dryRun: Boolean(options.dryRun),
|
|
167
|
+
});
|
|
168
|
+
});
|
|
56
169
|
return program;
|
|
57
170
|
}
|
|
58
171
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6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WAAW,CAAC,gCAAgC,CAAC,CAAC;IAExF,UAAU;SACP,OAAO,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;SACrC,WAAW,CAAC,qDAAqD,CAAC;SAClE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;QAClC,MAAM,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,kBAAkB,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEL,UAAU;SACP,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,mDAAmD,CAAC;SAChE,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,wBAAwB,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;IAEL,UAAU;SACP,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,yDAAyD,CAAC;SACtE,MAAM,CAAC,mBAAmB,EAAE,6DAA6D,EAAE,QAAQ,CAAC;SACpG,MAAM,CAAC,WAAW,EAAE,oDAAoD,CAAC;SACzE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,oBAAoB,CAAC;YACzB,MAAM,EAAE,OAAO,CAAC,MAA0B;YAC1C,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;SAChC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { formatDoctorReport, runDoctorChecks } from '../services/doctor.service.js';
|
|
2
|
+
export async function runDoctorCommand(params = {}) {
|
|
3
|
+
const doctorResult = await runDoctorChecks({ profileName: params.profileName });
|
|
4
|
+
if (params.json) {
|
|
5
|
+
process.stdout.write(`${JSON.stringify(doctorResult, null, 2)}\n`);
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
process.stdout.write(formatDoctorReport({ result: doctorResult }));
|
|
9
|
+
}
|
|
10
|
+
return doctorResult.passed ? 0 : 1;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=doctor.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.command.js","sourceRoot":"","sources":["../../src/commands/doctor.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAOpF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAAiC,EAAE;IACxE,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IAEhF,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { DEFAULT_API_BASE_URL, DEFAULT_CALLBACK_HOST, DEFAULT_CALLBACK_PATH, DEFAULT_CALLBACK_PORT, DEFAULT_REQUEST_TIMEOUT_MS, DEVELOPER_DOCS_URL, PARTNERS_PORTAL_URL, } from '../constants.js';
|
|
2
2
|
import { buildDefaultCredentials, getConfigFilePath, loadCredentials, saveCredentials, } from '../services/credentialStore.service.js';
|
|
3
|
+
import { ensureProfileDirectory, setActiveProfileName } from '../services/profileStore.service.js';
|
|
3
4
|
function normalizeApiBaseUrl(apiBaseUrl) {
|
|
4
5
|
return apiBaseUrl.replace(/\/+$/, '');
|
|
5
6
|
}
|
|
6
7
|
export async function runInitCommand(params) {
|
|
7
|
-
|
|
8
|
+
if (params.profileName) {
|
|
9
|
+
await ensureProfileDirectory({ profileName: params.profileName });
|
|
10
|
+
await setActiveProfileName({ profileName: params.profileName });
|
|
11
|
+
}
|
|
12
|
+
const configFilePath = params.configFilePath ?? getConfigFilePath({ profileName: params.profileName });
|
|
8
13
|
const existingCredentials = await loadCredentials({ configFilePath });
|
|
9
14
|
const resolvedApiBaseUrl = normalizeApiBaseUrl(params.apiBaseUrl ?? existingCredentials?.apiBaseUrl ?? DEFAULT_API_BASE_URL);
|
|
10
15
|
const apiBaseUrlChanged = Boolean(existingCredentials?.apiBaseUrl &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.command.js","sourceRoot":"","sources":["../../src/commands/init.command.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"init.command.js","sourceRoot":"","sources":["../../src/commands/init.command.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAUnG,SAAS,mBAAmB,CAAC,UAAkB;IAC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C7C,aAAa,EAAE,mBAAmB,EAAE,aAAa;aAClD;YACH,CAAC,CAAC,EAAE,CAAC;QACP,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,IAAI,0BAA0B;KACtF,CAAC;IAEF,MAAM,eAAe,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IAEvD,IAAI,yBAAyB,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sGAAsG,CAAC,CAAC;IAC/H,CAAC;SAAM,IAAI,iBAAiB,IAAI,mBAAmB,EAAE,WAAW,EAAE,CAAC;QACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oGAAoG,CAAC,CAAC;IAC7H,CAAC;IAED,MAAM,WAAW,GAAG,UAAU,qBAAqB,IAAI,qBAAqB,GAAG,qBAAqB,EAAE,CAAC;IAEvG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,cAAc,MAAM,CAAC,CAAC;IAC7E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAC;IACxG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,WAAW,MAAM,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,mBAAmB,IAAI,CAAC,CAAC;IAC/D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,kBAAkB,IAAI,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { runOAuthLogin } from '../services/oauthLogin.service.js';
|
|
2
2
|
import { getConfigFilePath, loadCredentials, saveCredentials } from '../services/credentialStore.service.js';
|
|
3
3
|
export async function runLoginCommand(params = {}) {
|
|
4
|
-
const credentials = await loadCredentials();
|
|
4
|
+
const credentials = await loadCredentials({ profileName: params.profileName });
|
|
5
5
|
if (!credentials?.clientId || !credentials.clientSecret) {
|
|
6
6
|
throw new Error('Partner credentials are not configured. Run `count init --client-id <id> --client-secret <secret>` first.');
|
|
7
7
|
}
|
|
@@ -10,10 +10,10 @@ export async function runLoginCommand(params = {}) {
|
|
|
10
10
|
callbackPort: params.callbackPort,
|
|
11
11
|
openBrowserAutomatically: params.openBrowserAutomatically,
|
|
12
12
|
});
|
|
13
|
-
await saveCredentials({ credentials: loginResult.credentials });
|
|
13
|
+
await saveCredentials({ credentials: loginResult.credentials, profileName: params.profileName });
|
|
14
14
|
const workspaceLabel = loginResult.credentials.workspaceName ?? loginResult.credentials.workspaceId ?? 'workspace';
|
|
15
15
|
process.stdout.write(`Logged in to ${workspaceLabel}.\n`);
|
|
16
|
-
process.stdout.write(`Credentials saved to ${getConfigFilePath()}\n`);
|
|
16
|
+
process.stdout.write(`Credentials saved to ${getConfigFilePath({ profileName: params.profileName })}\n`);
|
|
17
17
|
process.stdout.write('Run `count mcp` to start the local MCP server or `count mcp print-config` for Claude Code.\n');
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=login.command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.command.js","sourceRoot":"","sources":["../../src/commands/login.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"login.command.js","sourceRoot":"","sources":["../../src/commands/login.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAQ7G,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAgC,EAAE;IACtE,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IAE/E,IAAI,CAAC,WAAW,EAAE,QAAQ,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACb,2GAA2G,CAC5G,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC;QACtC,WAAW;QACX,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,wBAAwB,EAAE,MAAM,CAAC,wBAAwB;KAC1D,CAAC,CAAC;IAEH,MAAM,eAAe,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IAEjG,MAAM,cAAc,GAAG,WAAW,CAAC,WAAW,CAAC,aAAa,IAAI,WAAW,CAAC,WAAW,CAAC,WAAW,IAAI,WAAW,CAAC;IACnH,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,cAAc,KAAK,CAAC,CAAC;IAC1D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,iBAAiB,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;IACzG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8FAA8F,CAAC,CAAC;AACvH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { deleteCredentials, getConfigFilePath } from '../services/credentialStore.service.js';
|
|
2
|
-
export async function runLogoutCommand() {
|
|
3
|
-
await deleteCredentials();
|
|
4
|
-
process.stdout.write(`Removed stored credentials from ${getConfigFilePath()}\n`);
|
|
2
|
+
export async function runLogoutCommand(params = {}) {
|
|
3
|
+
await deleteCredentials({ profileName: params.profileName });
|
|
4
|
+
process.stdout.write(`Removed stored credentials from ${getConfigFilePath({ profileName: params.profileName })}\n`);
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=logout.command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.command.js","sourceRoot":"","sources":["../../src/commands/logout.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"logout.command.js","sourceRoot":"","sources":["../../src/commands/logout.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAM9F,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAAiC,EAAE;IACxE,MAAM,iBAAiB,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,iBAAiB,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;AACtH,CAAC"}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
interface RunMcpStartCommandParams {
|
|
2
|
+
profileName?: string;
|
|
3
|
+
}
|
|
4
|
+
export declare function runMcpStartCommand(params?: RunMcpStartCommandParams): Promise<void>;
|
|
2
5
|
export declare function runMcpPrintConfigCommand(): Promise<void>;
|
|
6
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildClaudeCodeMcpConfig, launchPartnerMcpServer } from '../services/mcpLauncher.service.js';
|
|
2
|
-
import { loadCredentials } from '../services/credentialStore.service.js';
|
|
2
|
+
import { getConfigFilePath, loadCredentials } from '../services/credentialStore.service.js';
|
|
3
3
|
function assertLoggedInCredentials(credentials) {
|
|
4
4
|
if (!credentials?.clientId || !credentials.clientSecret) {
|
|
5
5
|
throw new Error('Partner credentials are not configured. Run `count init` first.');
|
|
@@ -8,12 +8,15 @@ function assertLoggedInCredentials(credentials) {
|
|
|
8
8
|
throw new Error('You are not logged in. Run `count login` first.');
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export async function runMcpStartCommand() {
|
|
12
|
-
const credentials = await loadCredentials();
|
|
11
|
+
export async function runMcpStartCommand(params = {}) {
|
|
12
|
+
const credentials = await loadCredentials({ profileName: params.profileName });
|
|
13
13
|
assertLoggedInCredentials(credentials);
|
|
14
14
|
const workspaceLabel = credentials.workspaceName ?? credentials.workspaceId ?? 'authenticated workspace';
|
|
15
15
|
process.stderr.write(`COUNT MCP server started for ${workspaceLabel}. Listening on stdio — press Ctrl+C to stop.\n`);
|
|
16
|
-
const exitCode = await launchPartnerMcpServer({
|
|
16
|
+
const exitCode = await launchPartnerMcpServer({
|
|
17
|
+
credentials,
|
|
18
|
+
credentialsFilePath: getConfigFilePath({ profileName: params.profileName }),
|
|
19
|
+
});
|
|
17
20
|
process.exit(exitCode);
|
|
18
21
|
}
|
|
19
22
|
export async function runMcpPrintConfigCommand() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.command.js","sourceRoot":"","sources":["../../src/commands/mcp.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACtG,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp.command.js","sourceRoot":"","sources":["../../src/commands/mcp.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAE5F,SAAS,yBAAyB,CAChC,WAAwD;IAExD,IAAI,CAAC,WAAW,EAAE,QAAQ,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACrF,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;AACH,CAAC;AAMD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,SAAmC,EAAE;IAC5E,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IAC/E,yBAAyB,CAAC,WAAW,CAAC,CAAC;IAEvC,MAAM,cAAc,GAAG,WAAW,CAAC,aAAa,IAAI,WAAW,CAAC,WAAW,IAAI,yBAAyB,CAAC;IACzG,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,gCAAgC,cAAc,gDAAgD,CAC/F,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC;QAC5C,WAAW;QACX,mBAAmB,EAAE,iBAAiB,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;KAC5E,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,MAAM,aAAa,GAAG,wBAAwB,EAAE,CAAC;IACjD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type McpInstallTarget } from '../services/mcpInstall.service.js';
|
|
2
|
+
interface RunMcpInstallCommandParams {
|
|
3
|
+
target: McpInstallTarget;
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function runMcpInstallCommand(params: RunMcpInstallCommandParams): Promise<void>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { formatInstallMcpReport, installMcpConfiguration, } from '../services/mcpInstall.service.js';
|
|
2
|
+
export async function runMcpInstallCommand(params) {
|
|
3
|
+
const installationResults = await installMcpConfiguration({
|
|
4
|
+
target: params.target,
|
|
5
|
+
dryRun: params.dryRun,
|
|
6
|
+
});
|
|
7
|
+
process.stdout.write(formatInstallMcpReport({ installationResults }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=mcpInstall.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpInstall.command.js","sourceRoot":"","sources":["../../src/commands/mcpInstall.command.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GAExB,MAAM,mCAAmC,CAAC;AAO3C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAkC;IAC3E,MAAM,mBAAmB,GAAG,MAAM,uBAAuB,CAAC;QACxD,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,CAAC;IAEH,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;AACxE,CAAC"}
|