@qcobro/ctl 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +290 -0
- package/bin/dev.js +7 -0
- package/bin/run.js +9 -0
- package/dist/AuthenticatedCommand.d.ts +13 -0
- package/dist/AuthenticatedCommand.d.ts.map +1 -0
- package/dist/AuthenticatedCommand.js +32 -0
- package/dist/AuthenticatedCommand.js.map +1 -0
- package/dist/BaseCommand.d.ts +22 -0
- package/dist/BaseCommand.d.ts.map +1 -0
- package/dist/BaseCommand.js +33 -0
- package/dist/BaseCommand.js.map +1 -0
- package/dist/commands/agents/create.d.ts +25 -0
- package/dist/commands/agents/create.d.ts.map +1 -0
- package/dist/commands/agents/create.js +96 -0
- package/dist/commands/agents/create.js.map +1 -0
- package/dist/commands/agents/eval.d.ts +15 -0
- package/dist/commands/agents/eval.d.ts.map +1 -0
- package/dist/commands/agents/eval.js +70 -0
- package/dist/commands/agents/eval.js.map +1 -0
- package/dist/commands/agents/preview.d.ts +12 -0
- package/dist/commands/agents/preview.d.ts.map +1 -0
- package/dist/commands/agents/preview.js +35 -0
- package/dist/commands/agents/preview.js.map +1 -0
- package/dist/commands/agents/sync.d.ts +10 -0
- package/dist/commands/agents/sync.d.ts.map +1 -0
- package/dist/commands/agents/sync.js +39 -0
- package/dist/commands/agents/sync.js.map +1 -0
- package/dist/commands/mcp/configure.d.ts +20 -0
- package/dist/commands/mcp/configure.d.ts.map +1 -0
- package/dist/commands/mcp/configure.js +75 -0
- package/dist/commands/mcp/configure.js.map +1 -0
- package/dist/commands/portfolios/get.d.ts +10 -0
- package/dist/commands/portfolios/get.d.ts.map +1 -0
- package/dist/commands/portfolios/get.js +28 -0
- package/dist/commands/portfolios/get.js.map +1 -0
- package/dist/commands/portfolios/list.d.ts +10 -0
- package/dist/commands/portfolios/list.d.ts.map +1 -0
- package/dist/commands/portfolios/list.js +30 -0
- package/dist/commands/portfolios/list.js.map +1 -0
- package/dist/commands/portfolios/sync.d.ts +12 -0
- package/dist/commands/portfolios/sync.d.ts.map +1 -0
- package/dist/commands/portfolios/sync.js +41 -0
- package/dist/commands/portfolios/sync.js.map +1 -0
- package/dist/commands/workspaces/active.d.ts +7 -0
- package/dist/commands/workspaces/active.d.ts.map +1 -0
- package/dist/commands/workspaces/active.js +24 -0
- package/dist/commands/workspaces/active.js.map +1 -0
- package/dist/commands/workspaces/list.d.ts +7 -0
- package/dist/commands/workspaces/list.d.ts.map +1 -0
- package/dist/commands/workspaces/list.js +18 -0
- package/dist/commands/workspaces/list.js.map +1 -0
- package/dist/commands/workspaces/login.d.ts +8 -0
- package/dist/commands/workspaces/login.d.ts.map +1 -0
- package/dist/commands/workspaces/login.js +64 -0
- package/dist/commands/workspaces/login.js.map +1 -0
- package/dist/commands/workspaces/logout.d.ts +10 -0
- package/dist/commands/workspaces/logout.d.ts.map +1 -0
- package/dist/commands/workspaces/logout.js +23 -0
- package/dist/commands/workspaces/logout.js.map +1 -0
- package/dist/commands/workspaces/use.d.ts +10 -0
- package/dist/commands/workspaces/use.d.ts.map +1 -0
- package/dist/commands/workspaces/use.js +29 -0
- package/dist/commands/workspaces/use.js.map +1 -0
- package/dist/config/addWorkspace.d.ts +21 -0
- package/dist/config/addWorkspace.d.ts.map +1 -0
- package/dist/config/addWorkspace.js +27 -0
- package/dist/config/addWorkspace.js.map +1 -0
- package/dist/config/getActiveWorkspace.d.ts +4 -0
- package/dist/config/getActiveWorkspace.d.ts.map +1 -0
- package/dist/config/getActiveWorkspace.js +5 -0
- package/dist/config/getActiveWorkspace.js.map +1 -0
- package/dist/config/getConfig.d.ts +4 -0
- package/dist/config/getConfig.d.ts.map +1 -0
- package/dist/config/getConfig.js +10 -0
- package/dist/config/getConfig.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +9 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/removeWorkspace.d.ts +4 -0
- package/dist/config/removeWorkspace.d.ts.map +1 -0
- package/dist/config/removeWorkspace.js +5 -0
- package/dist/config/removeWorkspace.js.map +1 -0
- package/dist/config/saveConfig.d.ts +4 -0
- package/dist/config/saveConfig.d.ts.map +1 -0
- package/dist/config/saveConfig.js +10 -0
- package/dist/config/saveConfig.js.map +1 -0
- package/dist/config/schemas.d.ts +18 -0
- package/dist/config/schemas.d.ts.map +1 -0
- package/dist/config/schemas.js +22 -0
- package/dist/config/schemas.js.map +1 -0
- package/dist/config/setActiveWorkspace.d.ts +4 -0
- package/dist/config/setActiveWorkspace.d.ts.map +1 -0
- package/dist/config/setActiveWorkspace.js +8 -0
- package/dist/config/setActiveWorkspace.js.map +1 -0
- package/dist/config/types.d.ts +4 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/constants.d.ts +9 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +11 -0
- package/dist/constants.js.map +1 -0
- package/dist/mcpConfigure/paths.d.ts +9 -0
- package/dist/mcpConfigure/paths.d.ts.map +1 -0
- package/dist/mcpConfigure/paths.js +20 -0
- package/dist/mcpConfigure/paths.js.map +1 -0
- package/dist/mcpConfigure/writeClaudeConfig.d.ts +33 -0
- package/dist/mcpConfigure/writeClaudeConfig.d.ts.map +1 -0
- package/dist/mcpConfigure/writeClaudeConfig.js +44 -0
- package/dist/mcpConfigure/writeClaudeConfig.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
export default class Use extends Command {
|
|
3
|
+
static readonly description = "set a linked workspace as the active one";
|
|
4
|
+
static readonly examples: string[];
|
|
5
|
+
static readonly args: {
|
|
6
|
+
workspaceAccessKeyId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=use.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/commands/workspaces/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AAS5C,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACtC,gBAAyB,WAAW,8CAA8C;IAClF,gBAAyB,QAAQ,WAE/B;IACF,gBAAyB,IAAI;;MAK3B;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAkBlC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Args, Command } from "@oclif/core";
|
|
2
|
+
import { getActiveWorkspace, getConfig, saveConfig, setActiveWorkspace } from "../../config/index.js";
|
|
3
|
+
import { CONFIG_FILE } from "../../constants.js";
|
|
4
|
+
export default class Use extends Command {
|
|
5
|
+
static description = "set a linked workspace as the active one";
|
|
6
|
+
static examples = [
|
|
7
|
+
"<%= config.bin %> <%= command.id %> WO6ueex0qan9ojhf820wgiae3qi5luy08y"
|
|
8
|
+
];
|
|
9
|
+
static args = {
|
|
10
|
+
workspaceAccessKeyId: Args.string({
|
|
11
|
+
description: "the workspace to activate (its accessKeyId)",
|
|
12
|
+
required: true
|
|
13
|
+
})
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args } = await this.parse(Use);
|
|
17
|
+
const workspaces = getConfig(CONFIG_FILE);
|
|
18
|
+
const updated = setActiveWorkspace(args.workspaceAccessKeyId, workspaces);
|
|
19
|
+
const activeWorkspace = getActiveWorkspace(updated);
|
|
20
|
+
if (!activeWorkspace) {
|
|
21
|
+
this.error(`No linked workspace found with accessKeyId "${args.workspaceAccessKeyId}".`, {
|
|
22
|
+
exit: 1
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
saveConfig(CONFIG_FILE, updated);
|
|
26
|
+
this.log(`Current workspace: ${activeWorkspace.name} (${activeWorkspace.workspaceAccessKeyId})`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=use.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/commands/workspaces/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACtC,MAAM,CAAmB,WAAW,GAAG,0CAA0C,CAAC;IAClF,MAAM,CAAmB,QAAQ,GAAG;QAClC,wEAAwE;KACzE,CAAC;IACF,MAAM,CAAmB,IAAI,GAAG;QAC9B,oBAAoB,EAAE,IAAI,CAAC,MAAM,CAAC;YAChC,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;QAC1C,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;QAC1E,MAAM,eAAe,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAEpD,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,+CAA+C,IAAI,CAAC,oBAAoB,IAAI,EAAE;gBACvF,IAAI,EAAE,CAAC;aACR,CAAC,CAAC;QACL,CAAC;QAED,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAEjC,IAAI,CAAC,GAAG,CACN,sBAAsB,eAAe,CAAC,IAAI,KAAK,eAAe,CAAC,oBAAoB,GAAG,CACvF,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WorkspaceConfig } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validated function: adds (or replaces) a workspace in the configured list.
|
|
4
|
+
*
|
|
5
|
+
* A factory that injects the current `workspaces` list and returns a function
|
|
6
|
+
* that validates a candidate `WorkspaceConfig` against `workspaceConfigSchema`
|
|
7
|
+
* before ever touching the list — invalid input (e.g. a missing
|
|
8
|
+
* `accessKeySecret`) throws a structured `ValidationError` and the list is
|
|
9
|
+
* returned unchanged (the caller never persists it). On valid input, every
|
|
10
|
+
* other workspace is deactivated and the new (or updated) one is marked active,
|
|
11
|
+
* matching `@fonoster/ctl`'s `addWorkspace` behavior.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createAddWorkspace(workspaces: WorkspaceConfig[]): (params: unknown) => Promise<{
|
|
14
|
+
name: string;
|
|
15
|
+
endpoint: string;
|
|
16
|
+
workspaceAccessKeyId: string;
|
|
17
|
+
accessKeyId: string;
|
|
18
|
+
accessKeySecret: string;
|
|
19
|
+
active?: boolean | undefined;
|
|
20
|
+
}[]>;
|
|
21
|
+
//# sourceMappingURL=addWorkspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addWorkspace.d.ts","sourceRoot":"","sources":["../../src/config/addWorkspace.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,eAAe,EAAE;;;;;;;KAkB/D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { withErrorHandlingAndValidation } from "@qcobro/common";
|
|
2
|
+
import { workspaceConfigSchema } from "./schemas.js";
|
|
3
|
+
/**
|
|
4
|
+
* Validated function: adds (or replaces) a workspace in the configured list.
|
|
5
|
+
*
|
|
6
|
+
* A factory that injects the current `workspaces` list and returns a function
|
|
7
|
+
* that validates a candidate `WorkspaceConfig` against `workspaceConfigSchema`
|
|
8
|
+
* before ever touching the list — invalid input (e.g. a missing
|
|
9
|
+
* `accessKeySecret`) throws a structured `ValidationError` and the list is
|
|
10
|
+
* returned unchanged (the caller never persists it). On valid input, every
|
|
11
|
+
* other workspace is deactivated and the new (or updated) one is marked active,
|
|
12
|
+
* matching `@fonoster/ctl`'s `addWorkspace` behavior.
|
|
13
|
+
*/
|
|
14
|
+
export function createAddWorkspace(workspaces) {
|
|
15
|
+
const fn = async (config) => {
|
|
16
|
+
const deactivateAll = (list) => list.map((w) => ({ ...w, active: false }));
|
|
17
|
+
const index = workspaces.findIndex((w) => w.workspaceAccessKeyId === config.workspaceAccessKeyId);
|
|
18
|
+
if (index === -1) {
|
|
19
|
+
return deactivateAll(workspaces).concat({ ...config, active: true });
|
|
20
|
+
}
|
|
21
|
+
const updated = deactivateAll(workspaces);
|
|
22
|
+
updated[index] = { ...config, active: true };
|
|
23
|
+
return updated;
|
|
24
|
+
};
|
|
25
|
+
return withErrorHandlingAndValidation(fn, workspaceConfigSchema);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=addWorkspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addWorkspace.js","sourceRoot":"","sources":["../../src/config/addWorkspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAA6B;IAC9D,MAAM,EAAE,GAAG,KAAK,EAAE,MAAuB,EAA8B,EAAE;QACvE,MAAM,aAAa,GAAG,CAAC,IAAuB,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QAE9F,MAAM,KAAK,GAAG,UAAU,CAAC,SAAS,CAChC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,oBAAoB,KAAK,MAAM,CAAC,oBAAoB,CAC9D,CAAC;QAEF,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,OAAO,aAAa,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,OAAO,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;QAC1C,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,8BAA8B,CAAC,EAAE,EAAE,qBAAqB,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkspaceConfig } from "./types.js";
|
|
2
|
+
/** Returns the active workspace, or `undefined` if none is configured/active. */
|
|
3
|
+
export declare function getActiveWorkspace(workspaces: WorkspaceConfig[]): WorkspaceConfig | undefined;
|
|
4
|
+
//# sourceMappingURL=getActiveWorkspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getActiveWorkspace.d.ts","sourceRoot":"","sources":["../../src/config/getActiveWorkspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,eAAe,GAAG,SAAS,CAE7F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getActiveWorkspace.js","sourceRoot":"","sources":["../../src/config/getActiveWorkspace.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,UAAU,kBAAkB,CAAC,UAA6B;IAC9D,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../src/config/getConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,mGAAmG;AACnG,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CAOzD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
/** Reads the list of configured workspaces from `path`. Returns `[]` if the file doesn't exist. */
|
|
3
|
+
export function getConfig(path) {
|
|
4
|
+
if (!fs.existsSync(path)) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
const data = fs.readFileSync(path, "utf8");
|
|
8
|
+
return JSON.parse(data);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=getConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../src/config/getConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,mGAAmG;AACnG,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAsB,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./addWorkspace.js";
|
|
2
|
+
export * from "./getActiveWorkspace.js";
|
|
3
|
+
export * from "./getConfig.js";
|
|
4
|
+
export * from "./removeWorkspace.js";
|
|
5
|
+
export * from "./saveConfig.js";
|
|
6
|
+
export * from "./schemas.js";
|
|
7
|
+
export * from "./setActiveWorkspace.js";
|
|
8
|
+
export * from "./types.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./addWorkspace.js";
|
|
2
|
+
export * from "./getActiveWorkspace.js";
|
|
3
|
+
export * from "./getConfig.js";
|
|
4
|
+
export * from "./removeWorkspace.js";
|
|
5
|
+
export * from "./saveConfig.js";
|
|
6
|
+
export * from "./schemas.js";
|
|
7
|
+
export * from "./setActiveWorkspace.js";
|
|
8
|
+
export * from "./types.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkspaceConfig } from "./types.js";
|
|
2
|
+
/** Removes the workspace with `workspaceAccessKeyId` from the configured list. */
|
|
3
|
+
export declare function removeWorkspace(workspaceAccessKeyId: string, workspaces: WorkspaceConfig[]): WorkspaceConfig[];
|
|
4
|
+
//# sourceMappingURL=removeWorkspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeWorkspace.d.ts","sourceRoot":"","sources":["../../src/config/removeWorkspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,kFAAkF;AAClF,wBAAgB,eAAe,CAC7B,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,eAAe,EAAE,GAC5B,eAAe,EAAE,CAEnB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Removes the workspace with `workspaceAccessKeyId` from the configured list. */
|
|
2
|
+
export function removeWorkspace(workspaceAccessKeyId, workspaces) {
|
|
3
|
+
return workspaces.filter((w) => w.workspaceAccessKeyId !== workspaceAccessKeyId);
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=removeWorkspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeWorkspace.js","sourceRoot":"","sources":["../../src/config/removeWorkspace.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,MAAM,UAAU,eAAe,CAC7B,oBAA4B,EAC5B,UAA6B;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkspaceConfig } from "./types.js";
|
|
2
|
+
/** Writes the full list of configured workspaces to `path`, creating the parent dir if needed. */
|
|
3
|
+
export declare function saveConfig(path: string, config: WorkspaceConfig[]): void;
|
|
4
|
+
//# sourceMappingURL=saveConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveConfig.d.ts","sourceRoot":"","sources":["../../src/config/saveConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAKxE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { BASE_DIR } from "../constants.js";
|
|
3
|
+
/** Writes the full list of configured workspaces to `path`, creating the parent dir if needed. */
|
|
4
|
+
export function saveConfig(path, config) {
|
|
5
|
+
if (!fs.existsSync(BASE_DIR)) {
|
|
6
|
+
fs.mkdirSync(BASE_DIR, { recursive: true });
|
|
7
|
+
}
|
|
8
|
+
fs.writeFileSync(path, JSON.stringify(config, null, 2));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=saveConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveConfig.js","sourceRoot":"","sources":["../../src/config/saveConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,kGAAkG;AAClG,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,MAAyB;IAChE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Local schema for a single logged-in workspace entry in `~/.qcobro/config.json`.
|
|
4
|
+
* This describes the CLI's own local config file shape, not a cross-package API
|
|
5
|
+
* contract, so it lives here rather than in `@qcobro/common` — mirroring the
|
|
6
|
+
* precedent `mods/sdk/src/schemas.ts` sets for schemas that are local-only (see
|
|
7
|
+
* that file's own doc comment).
|
|
8
|
+
*/
|
|
9
|
+
export declare const workspaceConfigSchema: z.ZodObject<{
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
endpoint: z.ZodString;
|
|
12
|
+
workspaceAccessKeyId: z.ZodString;
|
|
13
|
+
accessKeyId: z.ZodString;
|
|
14
|
+
accessKeySecret: z.ZodString;
|
|
15
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type WorkspaceConfigInput = z.input<typeof workspaceConfigSchema>;
|
|
18
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/config/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;;;;;iBAYhC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Local schema for a single logged-in workspace entry in `~/.qcobro/config.json`.
|
|
4
|
+
* This describes the CLI's own local config file shape, not a cross-package API
|
|
5
|
+
* contract, so it lives here rather than in `@qcobro/common` — mirroring the
|
|
6
|
+
* precedent `mods/sdk/src/schemas.ts` sets for schemas that are local-only (see
|
|
7
|
+
* that file's own doc comment).
|
|
8
|
+
*/
|
|
9
|
+
export const workspaceConfigSchema = z.object({
|
|
10
|
+
/** Friendly local label; defaults to the workspace's accessKeyId. */
|
|
11
|
+
name: z.string().min(1, "The name value is required"),
|
|
12
|
+
/** QCobro API base URL this workspace was logged into. */
|
|
13
|
+
endpoint: z.string().min(1, "The endpoint value is required"),
|
|
14
|
+
/** The target workspace's accessKeyId (the `WO...` id acted in via `useWorkspace`). */
|
|
15
|
+
workspaceAccessKeyId: z.string().min(1, "The workspaceAccessKeyId value is required"),
|
|
16
|
+
/** Workspace API key id (`AP...`). */
|
|
17
|
+
accessKeyId: z.string().min(1, "The accessKeyId value is required"),
|
|
18
|
+
/** Workspace API key secret. */
|
|
19
|
+
accessKeySecret: z.string().min(1, "The accessKeySecret value is required"),
|
|
20
|
+
active: z.boolean().optional()
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/config/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,qEAAqE;IACrE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,4BAA4B,CAAC;IACrD,0DAA0D;IAC1D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,gCAAgC,CAAC;IAC7D,uFAAuF;IACvF,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,4CAA4C,CAAC;IACrF,sCAAsC;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mCAAmC,CAAC;IACnE,gCAAgC;IAChC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uCAAuC,CAAC;IAC3E,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkspaceConfig } from "./types.js";
|
|
2
|
+
/** Marks the workspace with `workspaceAccessKeyId` active, and every other one inactive. */
|
|
3
|
+
export declare function setActiveWorkspace(workspaceAccessKeyId: string, workspaces: WorkspaceConfig[]): WorkspaceConfig[];
|
|
4
|
+
//# sourceMappingURL=setActiveWorkspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setActiveWorkspace.d.ts","sourceRoot":"","sources":["../../src/config/setActiveWorkspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAChC,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,eAAe,EAAE,GAC5B,eAAe,EAAE,CAKnB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Marks the workspace with `workspaceAccessKeyId` active, and every other one inactive. */
|
|
2
|
+
export function setActiveWorkspace(workspaceAccessKeyId, workspaces) {
|
|
3
|
+
return workspaces.map((w) => ({
|
|
4
|
+
...w,
|
|
5
|
+
active: w.workspaceAccessKeyId === workspaceAccessKeyId
|
|
6
|
+
}));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=setActiveWorkspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setActiveWorkspace.js","sourceRoot":"","sources":["../../src/config/setActiveWorkspace.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,MAAM,UAAU,kBAAkB,CAChC,oBAA4B,EAC5B,UAA6B;IAE7B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5B,GAAG,CAAC;QACJ,MAAM,EAAE,CAAC,CAAC,oBAAoB,KAAK,oBAAoB;KACxD,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const BASE_DIR: string;
|
|
2
|
+
export declare const CONFIG_FILE: string;
|
|
3
|
+
/**
|
|
4
|
+
* Default QCobro API endpoint. Matches `@qcobro/sdk`'s own default (not
|
|
5
|
+
* exported by the SDK, so mirrored here) and `@qcobro/mcp`'s
|
|
6
|
+
* `DEFAULT_ENDPOINT` convention.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_ENDPOINT = "https://api.qcobro.com";
|
|
9
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,QAA6B,CAAC;AACnD,eAAO,MAAM,WAAW,QAA4C,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
export const BASE_DIR = join(homedir(), ".qcobro");
|
|
4
|
+
export const CONFIG_FILE = join(homedir(), ".qcobro", "config.json");
|
|
5
|
+
/**
|
|
6
|
+
* Default QCobro API endpoint. Matches `@qcobro/sdk`'s own default (not
|
|
7
|
+
* exported by the SDK, so mirrored here) and `@qcobro/mcp`'s
|
|
8
|
+
* `DEFAULT_ENDPOINT` convention.
|
|
9
|
+
*/
|
|
10
|
+
export const DEFAULT_ENDPOINT = "https://api.qcobro.com";
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAErE;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves Claude Desktop's config file path for the given platform.
|
|
3
|
+
*
|
|
4
|
+
* Ported from `mods/mcp/src/config/paths.ts` (behavior unchanged) as part of
|
|
5
|
+
* consolidating MCP-client configuration into `@qcobro/ctl`'s `mcp:configure`
|
|
6
|
+
* command.
|
|
7
|
+
*/
|
|
8
|
+
export declare function claudeDesktopConfigPath(platform: NodeJS.Platform, env: Record<string, string | undefined>): string;
|
|
9
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/mcpConfigure/paths.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACtC,MAAM,CAeR"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves Claude Desktop's config file path for the given platform.
|
|
5
|
+
*
|
|
6
|
+
* Ported from `mods/mcp/src/config/paths.ts` (behavior unchanged) as part of
|
|
7
|
+
* consolidating MCP-client configuration into `@qcobro/ctl`'s `mcp:configure`
|
|
8
|
+
* command.
|
|
9
|
+
*/
|
|
10
|
+
export function claudeDesktopConfigPath(platform, env) {
|
|
11
|
+
if (platform === "darwin") {
|
|
12
|
+
return join(homedir(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
13
|
+
}
|
|
14
|
+
if (platform === "win32") {
|
|
15
|
+
const appData = env.APPDATA ?? join(homedir(), "AppData", "Roaming");
|
|
16
|
+
return join(appData, "Claude", "claude_desktop_config.json");
|
|
17
|
+
}
|
|
18
|
+
throw new Error(`Unsupported platform for Claude Desktop config: ${platform}`);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/mcpConfigure/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAAyB,EACzB,GAAuC;IAEvC,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,IAAI,CACT,OAAO,EAAE,EACT,SAAS,EACT,qBAAqB,EACrB,QAAQ,EACR,4BAA4B,CAC7B,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,4BAA4B,CAAC,CAAC;IAC/D,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mDAAmD,QAAQ,EAAE,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ported from `mods/mcp/src/config/writeClaudeConfig.ts` (behavior unchanged)
|
|
3
|
+
* as part of consolidating MCP-client configuration into `@qcobro/ctl`'s
|
|
4
|
+
* `mcp:configure` command.
|
|
5
|
+
*/
|
|
6
|
+
export interface McpServerEntry {
|
|
7
|
+
command: string;
|
|
8
|
+
args: string[];
|
|
9
|
+
env: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
export interface ClaudeDesktopConfig {
|
|
12
|
+
mcpServers: Record<string, McpServerEntry>;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
/** Builds the `qcobro` MCP server entry from resolved credentials. */
|
|
16
|
+
export declare function buildQCobroEntry(config: {
|
|
17
|
+
endpoint: string;
|
|
18
|
+
accessKeyId: string;
|
|
19
|
+
accessKeySecret: string;
|
|
20
|
+
workspace: string;
|
|
21
|
+
}): McpServerEntry;
|
|
22
|
+
/**
|
|
23
|
+
* Merges a `qcobro` entry into an existing (possibly absent or unparseable)
|
|
24
|
+
* Claude Desktop config, preserving any other `mcpServers` entries already
|
|
25
|
+
* present. Pure — does no I/O.
|
|
26
|
+
*/
|
|
27
|
+
export declare function mergeClaudeConfig(existingRaw: string | undefined, entry: McpServerEntry): {
|
|
28
|
+
config: ClaudeDesktopConfig;
|
|
29
|
+
warning?: string;
|
|
30
|
+
};
|
|
31
|
+
/** Reads (if present), merges, and writes the `qcobro` entry into `configPath`. Returns any warning raised. */
|
|
32
|
+
export declare function writeClaudeConfig(configPath: string, entry: McpServerEntry): string | undefined;
|
|
33
|
+
//# sourceMappingURL=writeClaudeConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeClaudeConfig.d.ts","sourceRoot":"","sources":["../../src/mcpConfigure/writeClaudeConfig.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAWjB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,KAAK,EAAE,cAAc,GACpB;IAAE,MAAM,EAAE,mBAAmB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAenD;AAED,+GAA+G;AAC/G,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAQ/F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
/** Builds the `qcobro` MCP server entry from resolved credentials. */
|
|
4
|
+
export function buildQCobroEntry(config) {
|
|
5
|
+
return {
|
|
6
|
+
command: "npx",
|
|
7
|
+
args: ["-y", "@qcobro/mcp@latest"],
|
|
8
|
+
env: {
|
|
9
|
+
QCOBRO_ENDPOINT: config.endpoint,
|
|
10
|
+
QCOBRO_ACCESS_KEY_ID: config.accessKeyId,
|
|
11
|
+
QCOBRO_ACCESS_KEY_SECRET: config.accessKeySecret,
|
|
12
|
+
QCOBRO_WORKSPACE: config.workspace
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Merges a `qcobro` entry into an existing (possibly absent or unparseable)
|
|
18
|
+
* Claude Desktop config, preserving any other `mcpServers` entries already
|
|
19
|
+
* present. Pure — does no I/O.
|
|
20
|
+
*/
|
|
21
|
+
export function mergeClaudeConfig(existingRaw, entry) {
|
|
22
|
+
let config = { mcpServers: {} };
|
|
23
|
+
let warning;
|
|
24
|
+
if (existingRaw) {
|
|
25
|
+
try {
|
|
26
|
+
const parsed = JSON.parse(existingRaw);
|
|
27
|
+
config = { ...parsed, mcpServers: { ...(parsed.mcpServers ?? {}) } };
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
warning = "Could not parse existing Claude Desktop config; starting from a new one.";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
config.mcpServers.qcobro = entry;
|
|
34
|
+
return { config, warning };
|
|
35
|
+
}
|
|
36
|
+
/** Reads (if present), merges, and writes the `qcobro` entry into `configPath`. Returns any warning raised. */
|
|
37
|
+
export function writeClaudeConfig(configPath, entry) {
|
|
38
|
+
const existingRaw = existsSync(configPath) ? readFileSync(configPath, "utf8") : undefined;
|
|
39
|
+
const { config, warning } = mergeClaudeConfig(existingRaw, entry);
|
|
40
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
41
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
42
|
+
return warning;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=writeClaudeConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeClaudeConfig.js","sourceRoot":"","sources":["../../src/mcpConfigure/writeClaudeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC,sEAAsE;AACtE,MAAM,UAAU,gBAAgB,CAAC,MAKhC;IACC,OAAO;QACL,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,IAAI,EAAE,oBAAoB,CAAC;QAClC,GAAG,EAAE;YACH,eAAe,EAAE,MAAM,CAAC,QAAQ;YAChC,oBAAoB,EAAE,MAAM,CAAC,WAAW;YACxC,wBAAwB,EAAE,MAAM,CAAC,eAAe;YAChD,gBAAgB,EAAE,MAAM,CAAC,SAAS;SACnC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,WAA+B,EAC/B,KAAqB;IAErB,IAAI,MAAM,GAAwB,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IACrD,IAAI,OAA2B,CAAC;IAEhC,IAAI,WAAW,EAAE,CAAC;QAChB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAwB,CAAC;YAC9D,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QACvE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,GAAG,0EAA0E,CAAC;QACvF,CAAC;IACH,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC;IACjC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,iBAAiB,CAAC,UAAkB,EAAE,KAAqB;IACzE,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1F,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAElE,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAElE,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qcobro/ctl",
|
|
3
|
+
"version": "1.27.0",
|
|
4
|
+
"description": "Command-line tool for QCobro developers, built on @qcobro/sdk.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"qcobro": "./bin/run.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"bin"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -b --force",
|
|
18
|
+
"postbuild": "chmod +x ./bin/run.js",
|
|
19
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
20
|
+
"typecheck": "tsc --noEmit",
|
|
21
|
+
"test": "node --import tsx --test \"src/**/*.test.ts\"",
|
|
22
|
+
"generate:readme": "oclif readme"
|
|
23
|
+
},
|
|
24
|
+
"oclif": {
|
|
25
|
+
"bin": "qcobro",
|
|
26
|
+
"dirname": "qcobro",
|
|
27
|
+
"commands": "./dist/commands",
|
|
28
|
+
"topicSeparator": ":",
|
|
29
|
+
"plugins": [
|
|
30
|
+
"@oclif/plugin-warn-if-update-available"
|
|
31
|
+
],
|
|
32
|
+
"warn-if-update-available": {
|
|
33
|
+
"timeoutInDays": 7,
|
|
34
|
+
"message": "<%= config.name %> update available from <%= chalk.greenBright(config.version) %> to <%= chalk.greenBright(latest) %>.",
|
|
35
|
+
"frequency": 1,
|
|
36
|
+
"frequencyUnit": "days"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@inquirer/prompts": "^7.1.0",
|
|
41
|
+
"@oclif/core": "^4.0.34",
|
|
42
|
+
"@oclif/plugin-warn-if-update-available": "^3.1.28",
|
|
43
|
+
"@qcobro/common": "^1.27.0",
|
|
44
|
+
"@qcobro/sdk": "^1.27.0",
|
|
45
|
+
"chalk": "^5.3.0",
|
|
46
|
+
"cliui": "^8.0.1",
|
|
47
|
+
"yaml": "^2.9.0",
|
|
48
|
+
"zod": "^4.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@oclif/test": "^4.1.3",
|
|
52
|
+
"@qcobro/apiserver": "^1.27.0",
|
|
53
|
+
"@types/node": "22.10.1",
|
|
54
|
+
"oclif": "^4.17.46",
|
|
55
|
+
"tsx": "^4.0.0",
|
|
56
|
+
"typescript": "^5.9.0"
|
|
57
|
+
}
|
|
58
|
+
}
|