@codetelemetry/connect 0.2.0 → 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 +4 -2
- package/dist/bootstrap.js +9 -4
- package/dist/cli.js +6 -0
- package/dist/workspaces.d.ts +2 -1
- package/dist/workspaces.js +21 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,5 +6,7 @@ This package builds directly from the shared public client source, with no runti
|
|
|
6
6
|
dependency on the MCP server or its SDK.
|
|
7
7
|
|
|
8
8
|
Run `npx -y @codetelemetry/connect --help`. Kiro collection requires Node 24.
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
New `bootstrap` workspace setups enable prompt and tool-content capture by default;
|
|
10
|
+
use `--no-enrich` to opt out. Saved choices survive resumption. Personal onboarding
|
|
11
|
+
and repository-observation defaults are unchanged. See the repository README for
|
|
12
|
+
privacy, client setup and service removal.
|
package/dist/bootstrap.js
CHANGED
|
@@ -3,7 +3,7 @@ import fs from "node:fs";
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
|
-
import { bindWorkspace, bindingOf, codexWorkspaceProfilePath, writeCodexWorkspaceProfile, WORKSPACE_MCP_PACKAGE, contextPath, workspaceLock, loadWorkspace, readWorkspaceFile, saveWorkspace, workspaceHome, workspaceName, workspaceOrigin, writeWorkspaceFile, } from "./workspaces.js";
|
|
6
|
+
import { bindWorkspace, bindingOf, codexWorkspaceProfilePath, writeCodexWorkspaceProfile, workspaceCaptureDefault, WORKSPACE_MCP_PACKAGE, contextPath, workspaceLock, loadWorkspace, readWorkspaceFile, saveWorkspace, workspaceHome, workspaceName, workspaceOrigin, writeWorkspaceFile, } from "./workspaces.js";
|
|
7
7
|
import { resolveEndpoints } from "./config.js";
|
|
8
8
|
import { verifyScope, confirmLanded } from "./connectivity.js";
|
|
9
9
|
import { pollOnce } from "./deviceClient.js";
|
|
@@ -55,7 +55,7 @@ async function request(base, route, body, fetchImpl, deadline, key, scope) {
|
|
|
55
55
|
throw new Error(`Bootstrap request failed (HTTP ${response.status}${typeof result.error === "string" && /^[a-z_]{1,64}$/.test(result.error) ? `, ${result.error}` : ""}); resume after resolving it.`);
|
|
56
56
|
return result;
|
|
57
57
|
}
|
|
58
|
-
function validatePlan(options) {
|
|
58
|
+
function validatePlan(options, enrichDefault) {
|
|
59
59
|
workspaceName(options.name);
|
|
60
60
|
const allowed = new Set([
|
|
61
61
|
"name",
|
|
@@ -136,7 +136,11 @@ function validatePlan(options) {
|
|
|
136
136
|
: path.join(repositoryPath, ".claude", "settings.local.json");
|
|
137
137
|
if (configPath !== allowedConfig)
|
|
138
138
|
throw new Error("Bootstrap writes only this workspace's named Codex profile or repository-local Claude settings.");
|
|
139
|
-
return {
|
|
139
|
+
return {
|
|
140
|
+
...options,
|
|
141
|
+
...(options.enrich === undefined && enrichDefault !== undefined ? { enrich: enrichDefault } : {}),
|
|
142
|
+
repositoryPath, client, configPath,
|
|
143
|
+
};
|
|
140
144
|
}
|
|
141
145
|
export async function bootstrapWorkspace(options, environment = {}) {
|
|
142
146
|
if (options.reauthorize !== undefined &&
|
|
@@ -183,7 +187,8 @@ export async function bootstrapWorkspace(options, environment = {}) {
|
|
|
183
187
|
else {
|
|
184
188
|
if (options.organizationName && fs.existsSync(contextPath(name)))
|
|
185
189
|
throw new Error("This context already exists. Omit organizationName to configure it, or choose a new context name to create another organization.");
|
|
186
|
-
const
|
|
190
|
+
const existing = fs.existsSync(contextPath(name)) ? loadWorkspace(name) : null;
|
|
191
|
+
const plan = validatePlan(options, existing ? workspaceCaptureDefault(existing) : true);
|
|
187
192
|
state = {
|
|
188
193
|
version: 1,
|
|
189
194
|
name,
|
package/dist/cli.js
CHANGED
|
@@ -51,6 +51,7 @@ Usage:
|
|
|
51
51
|
codetelemetry-connect bootstrap <name> [--organization-name NAME | --organization-id ID]
|
|
52
52
|
[--client codex|claude] [--project PATH] [--plan FILE]
|
|
53
53
|
Resume with just bootstrap <name>. --plan supplies Grader checks/features.
|
|
54
|
+
New setups capture prompts/tool content; --no-enrich opts out.
|
|
54
55
|
codetelemetry-connect login [options] Authenticate via device code, then do the above
|
|
55
56
|
codetelemetry-connect doctor [options] Re-test the already-configured key
|
|
56
57
|
codetelemetry-connect print-config Print the config block (no key)
|
|
@@ -442,6 +443,11 @@ export async function run(argv) {
|
|
|
442
443
|
options.organizationId = flags["organization-id"];
|
|
443
444
|
if (typeof flags.client === "string")
|
|
444
445
|
options.client = flags.client;
|
|
446
|
+
if (flags.enrich !== undefined) {
|
|
447
|
+
if (typeof flags.enrich !== "boolean")
|
|
448
|
+
throw new Error("--enrich/--no-enrich must be a boolean flag.");
|
|
449
|
+
options.enrich = flags.enrich;
|
|
450
|
+
}
|
|
445
451
|
const result = await bootstrapWorkspace(options, { apiBase: typeof flags["api-base"] === "string" ? flags["api-base"] : undefined });
|
|
446
452
|
out(JSON.stringify(result, null, 2));
|
|
447
453
|
if (result.status === "authorization_required" && flags.open !== false && !flags.json)
|
package/dist/workspaces.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KeyScope } from "./connectivity.ts";
|
|
2
|
-
export declare const WORKSPACE_MCP_PACKAGE = "@codetelemetry/mcp@0.4.
|
|
2
|
+
export declare const WORKSPACE_MCP_PACKAGE = "@codetelemetry/mcp@0.4.1";
|
|
3
3
|
export declare const MAX_WORKSPACE_BYTES: number;
|
|
4
4
|
export declare const MAX_WORKSPACES = 64;
|
|
5
5
|
export type WorkspaceBinding = {
|
|
@@ -28,6 +28,7 @@ export declare function readWorkspaceFile(file: string, privateFile?: boolean):
|
|
|
28
28
|
export declare function writeWorkspaceText(file: string, data: string): void;
|
|
29
29
|
export declare function writeWorkspaceFile(file: string, value: unknown): void;
|
|
30
30
|
export declare function codexWorkspaceProfilePath(name: string): string;
|
|
31
|
+
export declare function workspaceCaptureDefault(context: WorkspaceContext): boolean;
|
|
31
32
|
export declare function writeCodexWorkspaceProfile(context: WorkspaceContext, options?: {
|
|
32
33
|
enrich?: boolean;
|
|
33
34
|
repositoryObservation?: boolean;
|
package/dist/workspaces.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
5
5
|
import { buildOtelSection } from "./codexConfig.js";
|
|
6
6
|
import { repositoryHookSource, quotedCommand, REPOSITORY_HOOK_FILE } from "./repositoryHook.js";
|
|
7
7
|
import { looksLikeKey } from "./keys.js";
|
|
8
|
-
export const WORKSPACE_MCP_PACKAGE = "@codetelemetry/mcp@0.4.
|
|
8
|
+
export const WORKSPACE_MCP_PACKAGE = "@codetelemetry/mcp@0.4.1";
|
|
9
9
|
export const MAX_WORKSPACE_BYTES = 64 * 1024;
|
|
10
10
|
export const MAX_WORKSPACES = 64;
|
|
11
11
|
export function workspaceName(value) {
|
|
@@ -145,7 +145,25 @@ export function writeWorkspaceFile(file, value) {
|
|
|
145
145
|
export function codexWorkspaceProfilePath(name) {
|
|
146
146
|
return path.join(process.env.CODEX_HOME || path.join(os.homedir(), ".codex"), `codetelemetry-${workspaceName(name)}.config.toml`);
|
|
147
147
|
}
|
|
148
|
+
export function workspaceCaptureDefault(context) {
|
|
149
|
+
if (context.clientConfig)
|
|
150
|
+
return context.clientConfig.enrich;
|
|
151
|
+
const file = codexWorkspaceProfilePath(context.name);
|
|
152
|
+
if (!fs.existsSync(file))
|
|
153
|
+
return true;
|
|
154
|
+
noLinks(file);
|
|
155
|
+
const stat = fs.lstatSync(file);
|
|
156
|
+
if (!stat.isFile() || stat.size > MAX_WORKSPACE_BYTES)
|
|
157
|
+
throw new Error("Invalid workspace profile.");
|
|
158
|
+
const text = fs.readFileSync(file, "utf8");
|
|
159
|
+
if (!text.startsWith(`# CodeTelemetry workspace ${context.name}\n`)) {
|
|
160
|
+
throw new Error("The Codex workspace profile is not managed by CodeTelemetry; choose a different context name.");
|
|
161
|
+
}
|
|
162
|
+
const section = text.match(/^\[otel\]\r?\n([\s\S]*?)(?=^\[|(?![\s\S]))/m)?.[1] ?? "";
|
|
163
|
+
return /^\s*log_user_prompt\s*=\s*true\s*(?:#.*)?$/m.test(section);
|
|
164
|
+
}
|
|
148
165
|
export function writeCodexWorkspaceProfile(context, options = {}) {
|
|
166
|
+
const enrich = options.enrich ?? workspaceCaptureDefault(context);
|
|
149
167
|
const profilePath = codexWorkspaceProfilePath(context.name), marker = `# CodeTelemetry workspace ${context.name}\n`;
|
|
150
168
|
upgradeLegacyCodexObserver(path.dirname(profilePath));
|
|
151
169
|
if (fs.existsSync(profilePath)) {
|
|
@@ -157,9 +175,9 @@ export function writeCodexWorkspaceProfile(context, options = {}) {
|
|
|
157
175
|
throw new Error("The Codex workspace profile is not managed by CodeTelemetry; choose a different context name.");
|
|
158
176
|
}
|
|
159
177
|
let text = marker +
|
|
160
|
-
buildOtelSection(context.ingestKey, context.ingestEndpoint,
|
|
178
|
+
buildOtelSection(context.ingestKey, context.ingestEndpoint, enrich) +
|
|
161
179
|
"\n";
|
|
162
|
-
if (!
|
|
180
|
+
if (!enrich)
|
|
163
181
|
text = text.replace("[otel]\n", "[otel]\nlog_user_prompt = false\n");
|
|
164
182
|
if (options.repositoryObservation) {
|
|
165
183
|
const hookPath = path.join(workspaceHome(), `${context.name}.hook.cjs`);
|