Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/gittensory-mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ gittensory-mcp logout --profile work

Use `--profile <name>` on `login`, `logout`, `whoami`, `config`, `status`, and `doctor`, or set `GITTENSORY_PROFILE`. `logout` only clears the selected local profile unless `--all` is passed. Profile output redacts session tokens and local config paths.

`gittensory-mcp config` prints the resolved effective configuration and the source that supplied each value (`environment`, `profile`, `config`, or `default`): the active API URL and its source, active profile and profile count, whether a config file is present and which environment variable steers its location, the cache-dir source, and whether a token is configured and where it came from. It never prints token values or local absolute paths. Add `--json` for machine-readable output.
`gittensory-mcp config` prints the resolved effective configuration and the source that supplied each value (`environment`, `profile`, `config`, or `default`): the active API URL and its source, active profile and profile count, whether a config file is present and which environment variable steers its location, the cache-dir source, whether a token is configured and where it came from, and whether `GITTENSORY_UPLOAD_SOURCE` has enabled the unsupported source-upload setting. It never prints token values or local absolute paths. Add `--json` for machine-readable output.

## Base-Agent Mode

Expand Down
18 changes: 16 additions & 2 deletions packages/gittensory-mcp/bin/gittensory-mcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2024,6 +2024,16 @@ function resolvedTokenSource() {
return "none";
}

function sourceUploadState() {
const enabled = /^(1|true|yes)$/i.test(process.env.GITTENSORY_UPLOAD_SOURCE ?? "false");
return {
default: false,
enabled,
source: enabled ? "GITTENSORY_UPLOAD_SOURCE" : "default",
supported: false,
};
}

// Report the resolved effective configuration and where each value came from, without leaking
// local absolute paths or token values. Distinct from `status` (health/version), `doctor`
// (diagnostic checks), and `whoami` (session identity): this answers "what config is in effect
Expand All @@ -2039,7 +2049,7 @@ function configCommand(options) {
cacheDirSource: process.env.GITTENSORY_CACHE_DIR ? "GITTENSORY_CACHE_DIR" : "default",
tokenConfigured: Boolean(getApiToken()),
tokenSource: resolvedTokenSource(),
sourceUpload: { default: false, supported: false },
sourceUpload: sourceUploadState(),
profile: profilePublicState(activeProfileName),
};
if (options.json) {
Expand All @@ -2051,7 +2061,11 @@ function configCommand(options) {
process.stdout.write(`Config file: ${payload.configured ? "present" : "absent"} (location: ${payload.configPathSource})\n`);
process.stdout.write(`Cache dir: ${payload.cacheDirSource}\n`);
process.stdout.write(`Token: ${payload.tokenConfigured ? `configured (${payload.tokenSource})` : "not configured"}\n`);
process.stdout.write("Source upload: disabled (unsupported)\n");
process.stdout.write(
payload.sourceUpload.enabled
? `Source upload: enabled via ${payload.sourceUpload.source} (unsupported; unset GITTENSORY_UPLOAD_SOURCE)\n`
: "Source upload: disabled (unsupported)\n",
);
}

function normalizeProfileName(value) {
Expand Down
14 changes: 12 additions & 2 deletions test/unit/mcp-cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ describe("gittensory-mcp CLI", () => {
cacheDirSource: string;
tokenConfigured: boolean;
tokenSource: string;
sourceUpload: { default: boolean; supported: boolean };
sourceUpload: { default: boolean; enabled: boolean; source: string; supported: boolean };
};
// The run() harness sets GITTENSORY_CONFIG_DIR but no API URL or token.
expect(payload.apiUrl).toBe("https://gittensory-api.aethereal.dev");
Expand All @@ -1109,7 +1109,7 @@ describe("gittensory-mcp CLI", () => {
expect(payload.cacheDirSource).toBe("default");
expect(payload.tokenConfigured).toBe(false);
expect(payload.tokenSource).toBe("none");
expect(payload.sourceUpload).toEqual({ default: false, supported: false });
expect(payload.sourceUpload).toEqual({ default: false, enabled: false, source: "default", supported: false });
});

it("attributes config values to environment overrides without leaking secrets", () => {
Expand All @@ -1133,6 +1133,16 @@ describe("gittensory-mcp CLI", () => {
}
});

it("reports enabled unsupported source upload environment settings via config", () => {
const payload = JSON.parse(run(["config", "--json"], { GITTENSORY_UPLOAD_SOURCE: "true" })) as {
sourceUpload: { default: boolean; enabled: boolean; source: string; supported: boolean };
};
expect(payload.sourceUpload).toEqual({ default: false, enabled: true, source: "GITTENSORY_UPLOAD_SOURCE", supported: false });

const out = run(["config"], { GITTENSORY_UPLOAD_SOURCE: "true" });
expect(out).toContain("Source upload: enabled via GITTENSORY_UPLOAD_SOURCE (unsupported; unset GITTENSORY_UPLOAD_SOURCE)");
});

it("attributes API URL and token to a named profile from the config file", () => {
const configDir = mkdtempSync(join(tmpdir(), "gittensory-config-profile-"));
try {
Expand Down