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/interfacectl-cli/dist/commands/analyze.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions packages/interfacectl-cli/dist/commands/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { mkdir, writeFile } from "node:fs/promises";
import path from "node:path";
import { inspectAuthProfile } from "../utils/auth-profiles.js";
import { analyzeSurface, stringifyStableArtifact, } from "../utils/first-run-analysis.js";
import { suggestSurfaceIdFromPath, suggestSurfaceIdFromUrl, suggestSurfaceName } from "../utils/onboarding.js";
import { normalizeRemoteUrlInput, suggestSurfaceIdFromPath, suggestSurfaceIdFromUrl, suggestSurfaceName, } from "../utils/onboarding.js";
import { redactSensitiveText } from "../utils/redaction.js";
const DEFAULT_OUT_DIR = "contracts/generated";
function normalizeSurfaceId(raw) {
Expand Down Expand Up @@ -39,6 +39,9 @@ export async function runAnalyzeCommand(options) {
const rootDir = process.cwd();
try {
const sourceMode = inferSourceMode(options);
const normalizedUrl = sourceMode === "remote-url" && options.url
? normalizeRemoteUrlInput(options.url)
: undefined;
if (sourceMode === "remote-url" && !options.url) {
throw new Error("Missing required --url for remote-url analysis.");
}
Expand All @@ -52,16 +55,16 @@ export async function runAnalyzeCommand(options) {
}
}
const surfaceSuggestion = options.surface ??
(sourceMode === "remote-url" && options.url
? suggestSurfaceIdFromUrl(options.url)
(sourceMode === "remote-url" && normalizedUrl
? suggestSurfaceIdFromUrl(normalizedUrl)
: suggestSurfaceIdFromPath(options.appRoot ?? "surface"));
const surfaceId = normalizeSurfaceId(surfaceSuggestion);
const surfaceName = options.surfaceName ?? suggestSurfaceName(surfaceId);
let authMode = "none";
let authProfileName;
let authStorageState;
if (sourceMode === "remote-url" && options.authProfile && options.url) {
const url = new URL(options.url);
if (sourceMode === "remote-url" && options.authProfile && normalizedUrl) {
const url = new URL(normalizedUrl);
const inspection = await inspectAuthProfile(options.authProfile, url.hostname);
if (inspection.status !== "ready" || !inspection.profile || !inspection.storageState) {
const reason = inspection.status === "missing"
Expand All @@ -83,7 +86,7 @@ export async function runAnalyzeCommand(options) {
surfaceName,
sourceMode,
appRoot: options.appRoot,
url: options.url,
url: normalizedUrl,
surfaceKindOverride: options.surfaceKind,
authMode,
authProfileName,
Expand All @@ -95,7 +98,7 @@ export async function runAnalyzeCommand(options) {
console.log(`Wrote analysis: ${outputPath}`);
console.log(`Inferred surface kind: ${result.analysis.classification.inferredKind} (${result.analysis.classification.confidence.toFixed(2)})`);
if (result.analysis.sourceHealth.status !== "ok") {
console.log(`Source access: ${result.analysis.sourceHealth.status} (${result.analysis.sourceHealth.confidence}) at ${result.analysis.sourceHealth.finalUrl ?? options.url}`);
console.log(`Source access: ${result.analysis.sourceHealth.status} (${result.analysis.sourceHealth.confidence}) at ${result.analysis.sourceHealth.finalUrl ?? normalizedUrl}`);
}
if (result.analysis.classification.requiresConfirmation && !options.surfaceKind) {
console.log("Note: classification is low confidence; pass --surface-kind to confirm seeding intent.");
Expand Down
2 changes: 1 addition & 1 deletion packages/interfacectl-cli/dist/commands/auth.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions packages/interfacectl-cli/dist/commands/auth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { captureBrowserStorageState, observeRemotePage } from "../utils/browser-session.js";
import { clearAuthProfiles, getAuthStorageMode, inspectAuthProfile, isLegacyAuthProfile, isProfileExpired, isProfileReplayReady, listAuthProfiles, saveReplayAuthProfile, } from "../utils/auth-profiles.js";
import { normalizeRemoteUrlInput } from "../utils/onboarding.js";
function buildProfileStatus(profile) {
if (!profile) {
return "missing";
Expand Down Expand Up @@ -54,7 +55,7 @@ export async function runAuthCaptureCommand(options) {
return 1;
}
try {
const requestedUrl = new URL(options.url);
const requestedUrl = new URL(normalizeRemoteUrlInput(options.url));
const captured = await captureBrowserStorageState({
url: requestedUrl.toString(),
});
Expand Down Expand Up @@ -105,7 +106,8 @@ export async function runAuthTestCommand(options) {
console.error("Missing --profile for auth test.");
return 1;
}
const domain = options.url ? new URL(options.url).hostname : options.domain;
const normalizedUrl = options.url ? normalizeRemoteUrlInput(options.url) : undefined;
const domain = normalizedUrl ? new URL(normalizedUrl).hostname : options.domain;
if (!domain) {
if (options.format === "json") {
console.log(JSON.stringify({ ok: false, error: "Provide --domain or --url for auth test." }, null, 2));
Expand Down Expand Up @@ -158,8 +160,9 @@ export async function runAuthTestCommand(options) {
return 0;
}
try {
const targetUrl = normalizedUrl ?? normalizeRemoteUrlInput(options.url);
const observation = await observeRemotePage({
url: options.url,
url: targetUrl,
storageState: inspection.storageState,
});
const ok = new URL(observation.finalUrl).hostname === inspection.profile.domain &&
Expand Down
2 changes: 1 addition & 1 deletion packages/interfacectl-cli/dist/commands/init.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/interfacectl-cli/dist/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { runValidateExtractedCommand } from "./validate-extracted.js";
import { getAuthStorageMode, inspectAuthProfile, saveReplayAuthProfile, } from "../utils/auth-profiles.js";
import { captureBrowserStorageState, observeRemotePage } from "../utils/browser-session.js";
import { analyzeSurface, stringifyStableArtifact, } from "../utils/first-run-analysis.js";
import { emitOnboardingRunArtifact, suggestSurfaceIdFromPath, suggestSurfaceIdFromUrl, suggestSurfaceName, } from "../utils/onboarding.js";
import { emitOnboardingRunArtifact, normalizeRemoteUrlInput, suggestSurfaceIdFromPath, suggestSurfaceIdFromUrl, suggestSurfaceName, } from "../utils/onboarding.js";
import { inferSourceMode, normalizeSurfaceId, promptGateResolution, promptInteractiveInitInputs, promptSurfaceKindConfirmation, promptWriteConfirmation, } from "../utils/init-interactive.js";
import { redactSensitiveText } from "../utils/redaction.js";
const DEFAULT_OUT_DIR = "contracts/generated";
Expand Down Expand Up @@ -74,7 +74,7 @@ async function resolveInputs(options) {
const surfaceName = options.surfaceName ?? suggestSurfaceName(surfaceId);
return {
sourceMode,
url: options.url ? new URL(options.url).toString() : undefined,
url: options.url ? normalizeRemoteUrlInput(options.url) : undefined,
appRoot: options.appRoot,
surfaceId,
surfaceName,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/interfacectl-cli/dist/utils/init-interactive.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import readline from "node:readline/promises";
import { stdin as input, stdout as output } from "node:process";
import { suggestSurfaceIdFromPath, suggestSurfaceIdFromUrl, suggestSurfaceName, } from "./onboarding.js";
import { normalizeRemoteUrlInput, suggestSurfaceIdFromPath, suggestSurfaceIdFromUrl, suggestSurfaceName, } from "./onboarding.js";
const VALID_SURFACE_KINDS = new Set(["marketing", "application", "unknown"]);
export function normalizeSurfaceId(raw) {
return raw
Expand Down Expand Up @@ -31,7 +31,7 @@ export async function promptInteractiveInitInputs(options) {
inferredMode).toLowerCase();
const sourceMode = rawMode === "remote-url" ? "remote-url" : "local-root";
const url = sourceMode === "remote-url"
? new URL(options.url ?? (await rl.question("Surface URL: ")).trim()).toString()
? normalizeRemoteUrlInput(options.url ?? (await rl.question("Surface URL: ")).trim())
: options.url?.trim() || undefined;
const appRoot = sourceMode === "local-root"
? (options.appRoot ?? (await rl.question("Local app root: "))).trim()
Expand Down
1 change: 1 addition & 0 deletions packages/interfacectl-cli/dist/utils/onboarding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface BootstrapExtractionReport {
};
};
}
export declare function normalizeRemoteUrlInput(rawInput: string): string;
export declare function suggestSurfaceIdFromUrl(rawUrl: string): string;
export declare function suggestSurfaceName(surfaceId: string): string;
export declare function suggestSurfaceIdFromPath(rawPath: string): string;
Expand Down
2 changes: 1 addition & 1 deletion packages/interfacectl-cli/dist/utils/onboarding.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading