@countfinancial/cli 0.1.6 → 0.2.1
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 +9 -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 +108 -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/partner-mcp/config.js +1 -1
- package/dist/partner-mcp/helpers/mcpKnowledge.helper.d.ts +19 -0
- package/dist/partner-mcp/helpers/mcpKnowledge.helper.js +293 -0
- package/dist/partner-mcp/helpers/mcpKnowledge.helper.js.map +1 -0
- package/dist/partner-mcp/helpers/mcpPayloadValidation.helper.d.ts +42 -0
- package/dist/partner-mcp/helpers/mcpPayloadValidation.helper.js +741 -0
- package/dist/partner-mcp/helpers/mcpPayloadValidation.helper.js.map +1 -0
- package/dist/partner-mcp/helpers/mcpPlaybooks.helper.d.ts +26 -0
- package/dist/partner-mcp/helpers/mcpPlaybooks.helper.js +210 -0
- package/dist/partner-mcp/helpers/mcpPlaybooks.helper.js.map +1 -0
- package/dist/partner-mcp/helpers/mcpRecoveryHint.helper.d.ts +22 -0
- package/dist/partner-mcp/helpers/mcpRecoveryHint.helper.js +203 -0
- package/dist/partner-mcp/helpers/mcpRecoveryHint.helper.js.map +1 -0
- package/dist/partner-mcp/helpers/mcpReferenceResolution.helper.d.ts +52 -0
- package/dist/partner-mcp/helpers/mcpReferenceResolution.helper.js +343 -0
- package/dist/partner-mcp/helpers/mcpReferenceResolution.helper.js.map +1 -0
- package/dist/partner-mcp/helpers/partnerErrorSanitization.helper.d.ts +18 -0
- package/dist/partner-mcp/helpers/partnerErrorSanitization.helper.js +63 -0
- package/dist/partner-mcp/helpers/partnerErrorSanitization.helper.js.map +1 -0
- package/dist/partner-mcp/partnerApiClient.d.ts +4 -0
- package/dist/partner-mcp/partnerApiClient.js +38 -1
- package/dist/partner-mcp/partnerApiClient.js.map +1 -1
- package/dist/partner-mcp/tools/definitions.js +233 -12
- package/dist/partner-mcp/tools/definitions.js.map +1 -1
- package/dist/partner-mcp/tools/registerTools.js +107 -23
- package/dist/partner-mcp/tools/registerTools.js.map +1 -1
- package/dist/partner-mcp/tools/schemas.d.ts +40 -0
- package/dist/partner-mcp/tools/schemas.js +55 -0
- package/dist/partner-mcp/tools/schemas.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/package.json +1 -1
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
|
|
|
@@ -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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AC3F,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QACtB,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,2BAA2B,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -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,EAA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I,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;QAC1G,MAAM,WAAW,GAAG,uBAAuB,CAAC;YAC1C,QAAQ,EAAE,kBAAkB;YAC5B,YAAY,EAAE,sBAAsB;SACrC,CAAC,CAAC;QAEH,MAAM,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,74 @@ 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 { runMcpInstallCommand } from './commands/mcpInstall.command.js';
|
|
5
7
|
import { runMcpPrintConfigCommand, runMcpStartCommand } from './commands/mcp.command.js';
|
|
8
|
+
import { runProfilesAddCommand, runProfilesListCommand, runProfilesUseCommand, } from './commands/profiles.command.js';
|
|
9
|
+
import { runSetupCommand } from './commands/setup.command.js';
|
|
6
10
|
import { runStatusCommand } from './commands/status.command.js';
|
|
11
|
+
function readGlobalOptions(command) {
|
|
12
|
+
let rootCommand = command;
|
|
13
|
+
while (rootCommand.parent) {
|
|
14
|
+
rootCommand = rootCommand.parent;
|
|
15
|
+
}
|
|
16
|
+
return rootCommand.opts();
|
|
17
|
+
}
|
|
7
18
|
export function createCli(params) {
|
|
8
19
|
const program = new Command();
|
|
9
20
|
program
|
|
10
21
|
.name('count')
|
|
11
22
|
.description('COUNT Partner CLI — OAuth login and local MCP for Claude Code, Cursor, and agents.')
|
|
12
|
-
.version(params.version)
|
|
23
|
+
.version(params.version)
|
|
24
|
+
.option('--profile <profileName>', 'Named credential profile under ~/.count/profiles/')
|
|
25
|
+
.option('--json', 'Emit machine-readable JSON output where supported');
|
|
26
|
+
program
|
|
27
|
+
.command('setup')
|
|
28
|
+
.description('Interactive setup wizard: credentials, login, MCP install, and health checks')
|
|
29
|
+
.option('--profile <profileName>', 'Profile name to create or update', 'default')
|
|
30
|
+
.option('--client-id <clientId>', 'Partner client ID (non-interactive mode)')
|
|
31
|
+
.option('--client-secret <clientSecret>', 'Partner client secret (non-interactive mode)')
|
|
32
|
+
.option('--api-url <apiUrl>', 'COUNT API base URL')
|
|
33
|
+
.option('--skip-login', 'Skip browser OAuth login')
|
|
34
|
+
.option('--skip-install', 'Skip MCP editor config install')
|
|
35
|
+
.option('--non-interactive', 'Run without prompts (requires client credentials flags when needed)')
|
|
36
|
+
.action(async (options, command) => {
|
|
37
|
+
const globalOptions = readGlobalOptions(command);
|
|
38
|
+
const exitCode = await runSetupCommand({
|
|
39
|
+
profileName: options.profile ?? globalOptions.profile,
|
|
40
|
+
clientId: options.clientId,
|
|
41
|
+
clientSecret: options.clientSecret,
|
|
42
|
+
apiBaseUrl: options.apiUrl,
|
|
43
|
+
skipLogin: options.skipLogin,
|
|
44
|
+
skipInstall: options.skipInstall,
|
|
45
|
+
nonInteractive: options.nonInteractive,
|
|
46
|
+
});
|
|
47
|
+
process.exit(exitCode);
|
|
48
|
+
});
|
|
49
|
+
program
|
|
50
|
+
.command('doctor')
|
|
51
|
+
.description('Run COUNT CLI and API health checks')
|
|
52
|
+
.action(async (_options, command) => {
|
|
53
|
+
const globalOptions = readGlobalOptions(command);
|
|
54
|
+
const exitCode = await runDoctorCommand({
|
|
55
|
+
profileName: globalOptions.profile,
|
|
56
|
+
json: globalOptions.json,
|
|
57
|
+
});
|
|
58
|
+
process.exit(exitCode);
|
|
59
|
+
});
|
|
13
60
|
program
|
|
14
61
|
.command('init')
|
|
15
62
|
.description('Save partner client credentials from COUNT Partners')
|
|
16
63
|
.requiredOption('--client-id <clientId>', 'Partner client ID')
|
|
17
64
|
.requiredOption('--client-secret <clientSecret>', 'Partner client secret')
|
|
18
65
|
.option('--api-url <apiUrl>', 'COUNT API base URL (default: prod, or keep existing saved URL)')
|
|
19
|
-
.action(async (options) => {
|
|
66
|
+
.action(async (options, command) => {
|
|
67
|
+
const globalOptions = readGlobalOptions(command);
|
|
20
68
|
await runInitCommand({
|
|
21
69
|
clientId: options.clientId,
|
|
22
70
|
clientSecret: options.clientSecret,
|
|
23
71
|
apiBaseUrl: options.apiUrl,
|
|
72
|
+
profileName: globalOptions.profile,
|
|
24
73
|
});
|
|
25
74
|
});
|
|
26
75
|
program
|
|
@@ -28,24 +77,63 @@ export function createCli(params) {
|
|
|
28
77
|
.description('Sign in through COUNT partner OAuth and store workspace tokens')
|
|
29
78
|
.option('--port <port>', 'Local OAuth callback port', (value) => Number.parseInt(value, 10))
|
|
30
79
|
.option('--no-open', 'Print the sign-in URL instead of opening a browser')
|
|
31
|
-
.action(async (options) => {
|
|
80
|
+
.action(async (options, command) => {
|
|
81
|
+
const globalOptions = readGlobalOptions(command);
|
|
32
82
|
await runLoginCommand({
|
|
33
83
|
callbackPort: options.port,
|
|
34
84
|
openBrowserAutomatically: options.open,
|
|
85
|
+
profileName: globalOptions.profile,
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
program.command('logout').description('Remove stored COUNT CLI credentials').action(async (_options, command) => {
|
|
89
|
+
const globalOptions = readGlobalOptions(command);
|
|
90
|
+
await runLogoutCommand({ profileName: globalOptions.profile });
|
|
91
|
+
});
|
|
92
|
+
program.command('status').description('Show stored credential state').action(async (_options, command) => {
|
|
93
|
+
const globalOptions = readGlobalOptions(command);
|
|
94
|
+
await runStatusCommand({
|
|
95
|
+
profileName: globalOptions.profile,
|
|
96
|
+
json: globalOptions.json,
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
const profilesCommand = program.command('profiles').description('Manage named credential profiles');
|
|
100
|
+
profilesCommand
|
|
101
|
+
.command('list')
|
|
102
|
+
.description('List saved credential profiles')
|
|
103
|
+
.action(async (_options, command) => {
|
|
104
|
+
const globalOptions = readGlobalOptions(command);
|
|
105
|
+
await runProfilesListCommand({
|
|
106
|
+
profileName: globalOptions.profile,
|
|
107
|
+
json: globalOptions.json,
|
|
35
108
|
});
|
|
36
109
|
});
|
|
37
|
-
|
|
38
|
-
|
|
110
|
+
profilesCommand
|
|
111
|
+
.command('add <profileName>')
|
|
112
|
+
.description('Create a profile and save partner client credentials')
|
|
113
|
+
.requiredOption('--client-id <clientId>', 'Partner client ID')
|
|
114
|
+
.requiredOption('--client-secret <clientSecret>', 'Partner client secret')
|
|
115
|
+
.option('--api-url <apiUrl>', 'COUNT API base URL')
|
|
116
|
+
.action(async (profileName, options) => {
|
|
117
|
+
await runProfilesAddCommand({
|
|
118
|
+
profileName,
|
|
119
|
+
clientId: options.clientId,
|
|
120
|
+
clientSecret: options.clientSecret,
|
|
121
|
+
apiBaseUrl: options.apiUrl,
|
|
122
|
+
});
|
|
39
123
|
});
|
|
40
|
-
|
|
41
|
-
|
|
124
|
+
profilesCommand
|
|
125
|
+
.command('use <profileName>')
|
|
126
|
+
.description('Switch the active credential profile')
|
|
127
|
+
.action(async (profileName) => {
|
|
128
|
+
await runProfilesUseCommand({ profileName });
|
|
42
129
|
});
|
|
43
130
|
const mcpCommand = program.command('mcp').description('Local COUNT Partner MCP server');
|
|
44
131
|
mcpCommand
|
|
45
132
|
.command('start', { isDefault: true })
|
|
46
133
|
.description('Start the stdio MCP server using stored credentials')
|
|
47
|
-
.action(async () => {
|
|
48
|
-
|
|
134
|
+
.action(async (_options, command) => {
|
|
135
|
+
const globalOptions = readGlobalOptions(command);
|
|
136
|
+
await runMcpStartCommand({ profileName: globalOptions.profile });
|
|
49
137
|
});
|
|
50
138
|
mcpCommand
|
|
51
139
|
.command('print-config')
|
|
@@ -53,6 +141,17 @@ export function createCli(params) {
|
|
|
53
141
|
.action(async () => {
|
|
54
142
|
await runMcpPrintConfigCommand();
|
|
55
143
|
});
|
|
144
|
+
mcpCommand
|
|
145
|
+
.command('install')
|
|
146
|
+
.description('Install COUNT MCP config into Cursor or Claude settings')
|
|
147
|
+
.option('--target <target>', 'Install target: cursor, claude-code, claude-desktop, or all', 'cursor')
|
|
148
|
+
.option('--dry-run', 'Show what would be written without modifying files')
|
|
149
|
+
.action(async (options) => {
|
|
150
|
+
await runMcpInstallCommand({
|
|
151
|
+
target: options.target,
|
|
152
|
+
dryRun: Boolean(options.dryRun),
|
|
153
|
+
});
|
|
154
|
+
});
|
|
56
155
|
return program;
|
|
57
156
|
}
|
|
58
157
|
//# 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,6BAA6B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1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AAE,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,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7C,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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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","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C,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface RunProfilesListCommandParams {
|
|
2
|
+
profileName?: string;
|
|
3
|
+
json?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function runProfilesListCommand(params?: RunProfilesListCommandParams): Promise<void>;
|
|
6
|
+
interface RunProfilesAddCommandParams {
|
|
7
|
+
profileName: string;
|
|
8
|
+
clientId: string;
|
|
9
|
+
clientSecret: string;
|
|
10
|
+
apiBaseUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function runProfilesAddCommand(params: RunProfilesAddCommandParams): Promise<void>;
|
|
13
|
+
interface RunProfilesUseCommandParams {
|
|
14
|
+
profileName: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function runProfilesUseCommand(params: RunProfilesUseCommandParams): Promise<void>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { getConfigFilePath, loadCredentials } from '../services/credentialStore.service.js';
|
|
2
|
+
import { DEFAULT_PROFILE_NAME, ensureProfileDirectory, getActiveProfileName, listProfileNames, migrateLegacyCredentialsToProfile, setActiveProfileName, } from '../services/profileStore.service.js';
|
|
3
|
+
import { runInitCommand } from './init.command.js';
|
|
4
|
+
export async function runProfilesListCommand(params = {}) {
|
|
5
|
+
const profileNames = await listProfileNames();
|
|
6
|
+
const activeProfileName = await getActiveProfileName();
|
|
7
|
+
if (params.json) {
|
|
8
|
+
process.stdout.write(`${JSON.stringify({
|
|
9
|
+
activeProfile: activeProfileName,
|
|
10
|
+
profiles: profileNames,
|
|
11
|
+
}, null, 2)}\n`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (profileNames.length === 0) {
|
|
15
|
+
process.stdout.write('No profiles found. Run `count setup` or `count profiles add <name>`.\n');
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
for (const listedProfileName of profileNames) {
|
|
19
|
+
const marker = listedProfileName === activeProfileName ? '*' : ' ';
|
|
20
|
+
let credentials = await loadCredentials({ profileName: listedProfileName });
|
|
21
|
+
if (!credentials && listedProfileName === DEFAULT_PROFILE_NAME) {
|
|
22
|
+
credentials = await loadCredentials();
|
|
23
|
+
}
|
|
24
|
+
const workspaceLabel = credentials?.workspaceName ?? credentials?.workspaceId ?? 'not logged in';
|
|
25
|
+
process.stdout.write(`${marker} ${listedProfileName} — ${workspaceLabel}\n`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export async function runProfilesAddCommand(params) {
|
|
29
|
+
await ensureProfileDirectory({ profileName: params.profileName });
|
|
30
|
+
await runInitCommand({
|
|
31
|
+
clientId: params.clientId,
|
|
32
|
+
clientSecret: params.clientSecret,
|
|
33
|
+
apiBaseUrl: params.apiBaseUrl,
|
|
34
|
+
profileName: params.profileName,
|
|
35
|
+
});
|
|
36
|
+
process.stdout.write(`Profile "${params.profileName}" saved. Run \`count login --profile ${params.profileName}\`.\n`);
|
|
37
|
+
}
|
|
38
|
+
export async function runProfilesUseCommand(params) {
|
|
39
|
+
await migrateLegacyCredentialsToProfile({ profileName: params.profileName });
|
|
40
|
+
const credentials = await loadCredentials({ profileName: params.profileName });
|
|
41
|
+
if (!credentials) {
|
|
42
|
+
throw new Error(`Profile "${params.profileName}" has no credentials yet. Run \`count profiles add ${params.profileName}\` first.`);
|
|
43
|
+
}
|
|
44
|
+
await setActiveProfileName({ profileName: params.profileName });
|
|
45
|
+
process.stdout.write(`Active profile set to "${params.profileName}".\n`);
|
|
46
|
+
process.stdout.write(`Credentials: ${getConfigFilePath({ profileName: params.profileName })}\n`);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=profiles.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.command.js","sourceRoot":"","sources":["../../src/commands/profiles.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,iCAAiC,EACjC,oBAAoB,GACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,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