@iamu-dev/iamu 0.0.0-stage → 0.2.0-beta.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/LICENSE +9 -0
- package/README.md +103 -2
- package/dist/adapters/claude-plugin.d.ts +13 -0
- package/dist/adapters/registry.d.ts +6 -0
- package/dist/adapters/types.d.ts +19 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +21005 -0
- package/dist/build-info.d.ts +53 -0
- package/dist/cloud-url.d.ts +19 -0
- package/dist/commands/auth-http.d.ts +37 -0
- package/dist/commands/auth-project-choice.d.ts +74 -0
- package/dist/commands/auth-token-input.d.ts +21 -0
- package/dist/commands/auth.d.ts +84 -0
- package/dist/commands/browse-actions.d.ts +56 -0
- package/dist/commands/browse-driver.d.ts +117 -0
- package/dist/commands/browse.d.ts +156 -0
- package/dist/commands/cloud-push.d.ts +27 -0
- package/dist/commands/complete.d.ts +131 -0
- package/dist/commands/completion.d.ts +2 -0
- package/dist/commands/context.d.ts +58 -0
- package/dist/commands/credentials.d.ts +144 -0
- package/dist/commands/diff-filter.d.ts +11 -0
- package/dist/commands/doctor.d.ts +24 -0
- package/dist/commands/evaluate.d.ts +30 -0
- package/dist/commands/findings.d.ts +7 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/instructions-walk.d.ts +59 -0
- package/dist/commands/list.d.ts +5 -0
- package/dist/commands/match.d.ts +12 -0
- package/dist/commands/mcp-config.d.ts +10 -0
- package/dist/commands/new-entity.d.ts +15 -0
- package/dist/commands/new-finding.d.ts +19 -0
- package/dist/commands/open.d.ts +8 -0
- package/dist/commands/port.d.ts +17 -0
- package/dist/commands/prune.d.ts +11 -0
- package/dist/commands/pull.d.ts +5 -0
- package/dist/commands/register-cloud.d.ts +5 -0
- package/dist/commands/register-findings.d.ts +5 -0
- package/dist/commands/register-project.d.ts +5 -0
- package/dist/commands/register-walkthrough.d.ts +5 -0
- package/dist/commands/register.d.ts +10 -0
- package/dist/commands/report.d.ts +3 -0
- package/dist/commands/serve.d.ts +11 -0
- package/dist/commands/skills.d.ts +34 -0
- package/dist/commands/start-run.d.ts +49 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/step-numbering.d.ts +87 -0
- package/dist/commands/step.d.ts +95 -0
- package/dist/commands/sync.d.ts +6 -0
- package/dist/commands/triage.d.ts +21 -0
- package/dist/commands/update.d.ts +4 -0
- package/dist/commands/validate.d.ts +8 -0
- package/dist/commands/view-results.d.ts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +20852 -0
- package/dist/sync-mcp/fatal.d.ts +42 -0
- package/dist/sync-mcp/server.d.ts +1 -0
- package/dist/sync-mcp/tools.d.ts +12 -0
- package/dist/templates/prompts/combine.md +69 -0
- package/dist/templates/prompts/complete.md +132 -0
- package/dist/templates/prompts/evaluate.md +64 -0
- package/dist/templates/prompts/outline.md +54 -0
- package/dist/templates/prompts/persona.md +40 -0
- package/dist/templates/prompts/walk.md +167 -0
- package/dist/templates/skills/iamu-findings.md +228 -0
- package/dist/templates/skills/iamu-new.md +206 -0
- package/dist/templates/skills/iamu-propose.md +124 -0
- package/dist/templates/skills/iamu-run.md +400 -0
- package/dist/templates/skills/iamu-setup.md +192 -0
- package/dist/templates/skills/iamu-status.md +64 -0
- package/dist/templates.d.ts +10 -0
- package/dist/ui/journey-diff.d.ts +3 -0
- package/dist/ui/json.d.ts +6 -0
- package/dist/ui/logger.d.ts +5 -0
- package/dist/ui/panic.d.ts +11 -0
- package/dist/ui/symbols.d.ts +11 -0
- package/dist/ui/table.d.ts +20 -0
- package/dist/ui/update-check.d.ts +6 -0
- package/dist/worktree-state.d.ts +49 -0
- package/package.json +69 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { type JourneyDiff, type RevisitPlaceCoverage, type VerificationSummary, type WalkthroughManifest } from "@iamu-dev/local-store";
|
|
2
|
+
import { type CanonicalWalkthrough, type RunViewport } from "@iamu-dev/protocol";
|
|
3
|
+
import { type CloudRunInfo } from "./cloud-push.js";
|
|
4
|
+
export interface CompleteOptions {
|
|
5
|
+
cwd?: string;
|
|
6
|
+
json?: boolean;
|
|
7
|
+
force?: boolean;
|
|
8
|
+
yes?: boolean;
|
|
9
|
+
prompt?: boolean;
|
|
10
|
+
view?: boolean;
|
|
11
|
+
strictProvenance?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Non-fatal observations made while completing, reported after assembly. */
|
|
14
|
+
export interface CompletionExtras {
|
|
15
|
+
revisit: RevisitReport | null;
|
|
16
|
+
viewportWarning: string | null;
|
|
17
|
+
codeWarning: string | null;
|
|
18
|
+
cloudInfo: CloudRunInfo | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* `iamu complete <run-id>`: assemble canonical.json + report.md, mark the
|
|
22
|
+
* run completed, push it when cloud-linked and report the outcome.
|
|
23
|
+
*/
|
|
24
|
+
export declare function complete(runId: string, opts?: CompleteOptions): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* The run's completion time. `--force` reassembles the report of a finished
|
|
27
|
+
* run; the run still finished when it first completed. Re-stamping would
|
|
28
|
+
* move every re-assembled run to "now", which breaks run ordering and
|
|
29
|
+
* durations downstream.
|
|
30
|
+
*/
|
|
31
|
+
export declare function pickCompletedAt(manifest: Pick<WalkthroughManifest, "completed_at">, now?: () => Date): string;
|
|
32
|
+
/** The manifest with its status flipped to completed. */
|
|
33
|
+
export declare function completedManifest(manifest: WalkthroughManifest, completedAt: string): WalkthroughManifest;
|
|
34
|
+
/** Persist the completed manifest to disk atomically. */
|
|
35
|
+
export declare function persistManifest(manifestPath: string, manifest: WalkthroughManifest, completedAt: string): Promise<WalkthroughManifest>;
|
|
36
|
+
/** `complete --json` output: the canonical plus whichever extras exist. */
|
|
37
|
+
export declare function completeJsonPayload(canonical: CanonicalWalkthrough, extras: CompletionExtras): Record<string, unknown>;
|
|
38
|
+
/** Non-fatal provenance warnings; prints nothing for a clean audit. */
|
|
39
|
+
export declare function printProvenanceWarnings(audit: ProvenanceAudit): void;
|
|
40
|
+
/** Width and height from a PNG's IHDR chunk; null if it is not a PNG. */
|
|
41
|
+
export declare function pngSize(head: Buffer): {
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
} | null;
|
|
45
|
+
/**
|
|
46
|
+
* Is a screenshot `width` px wide consistent with a viewport `expected`
|
|
47
|
+
* CSS px wide? At 1× within 20%; at a 2× or 3× device pixel ratio the
|
|
48
|
+
* width is an exact multiple, so within 5% — wide enough for a scrollbar,
|
|
49
|
+
* narrow enough that a 1280 px desktop shot never passes as a 3× phone.
|
|
50
|
+
*/
|
|
51
|
+
export declare function screenshotFitsViewport(width: number, expected: number): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* A warning when the run's first screenshot is not the width of the
|
|
54
|
+
* device its persona uses — the browser was left at another persona's
|
|
55
|
+
* size. Null when the run recorded no viewport, has no screenshots, or
|
|
56
|
+
* the sizes agree. Never fatal.
|
|
57
|
+
*/
|
|
58
|
+
export declare function screenshotSizeWarning(runDirPath: string, viewport: RunViewport | null): Promise<string | null>;
|
|
59
|
+
export interface ProvenanceAudit {
|
|
60
|
+
verified: boolean;
|
|
61
|
+
warnings: string[];
|
|
62
|
+
step_count: number;
|
|
63
|
+
duration_seconds: number | null;
|
|
64
|
+
avg_step_interval_seconds: number | null;
|
|
65
|
+
uniform_intervals: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Audit steps for suspicious timing anomalies that indicate programmatic batch
|
|
69
|
+
* generation (scripts, mocks) rather than interactive human/LLM persona execution.
|
|
70
|
+
*/
|
|
71
|
+
export declare function auditStepProvenance(steps: Array<{
|
|
72
|
+
timestamp?: string;
|
|
73
|
+
action?: string;
|
|
74
|
+
step_number?: number;
|
|
75
|
+
}>): ProvenanceAudit;
|
|
76
|
+
/** Strictly validate runtime canonical structure against the protocol schema. */
|
|
77
|
+
export declare function validateCanonicalWalkthrough(canonical: unknown): CanonicalWalkthrough;
|
|
78
|
+
/**
|
|
79
|
+
* Read recorded judge verdicts (if present) and overlay them onto the canonical
|
|
80
|
+
* walkthrough for report markdown rendering.
|
|
81
|
+
*/
|
|
82
|
+
export declare function applyRecordedVerdicts(canonical: CanonicalWalkthrough, runDirPath: string): Promise<CanonicalWalkthrough>;
|
|
83
|
+
/** Persist canonical.json to disk atomically. */
|
|
84
|
+
export declare function persistCanonical(runDirPath: string, canonical: CanonicalWalkthrough): Promise<string>;
|
|
85
|
+
/** Persist report.md to disk atomically. */
|
|
86
|
+
export declare function persistReport(runDirPath: string, canonical: CanonicalWalkthrough): Promise<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Build canonical.json (with the verification delta) and report.md for a
|
|
89
|
+
* run. The report keeps any verdicts already recorded by
|
|
90
|
+
* `evaluate-record`, so re-assembling after the judge (`--force`,
|
|
91
|
+
* `match-record`) does not drop them.
|
|
92
|
+
*/
|
|
93
|
+
export declare function assembleRun(projectRoot: string, runId: string, manifest: WalkthroughManifest, completedAt: string): Promise<{
|
|
94
|
+
canonical: CanonicalWalkthrough;
|
|
95
|
+
verification: VerificationSummary | null;
|
|
96
|
+
journeyDiff: JourneyDiff | null;
|
|
97
|
+
canonicalWithVerification: CanonicalWalkthrough & {
|
|
98
|
+
provenance_audit?: ProvenanceAudit;
|
|
99
|
+
};
|
|
100
|
+
canonicalPath: string;
|
|
101
|
+
reportPath: string;
|
|
102
|
+
}>;
|
|
103
|
+
/** One requested place, whether the run reached it, and what awaits there. */
|
|
104
|
+
export type RevisitReportPlace = RevisitPlaceCoverage & {
|
|
105
|
+
findings: Array<{
|
|
106
|
+
id: string;
|
|
107
|
+
title: string;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
110
|
+
/** Coverage of the run's places to pass through, with finding titles. */
|
|
111
|
+
export interface RevisitReport {
|
|
112
|
+
requested: number;
|
|
113
|
+
reached: number;
|
|
114
|
+
places: RevisitReportPlace[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Did the run reach the places `start-run` asked it to pass through
|
|
118
|
+
* (manifest `revisit`)? Null when it asked for none. Local only: the
|
|
119
|
+
* cloud manifest has no field for it. Titles are for the person reading
|
|
120
|
+
* this output — the walker never saw them.
|
|
121
|
+
*/
|
|
122
|
+
export declare function revisitReport(projectRoot: string, runId: string, manifest: WalkthroughManifest): Promise<RevisitReport | null>;
|
|
123
|
+
/** Print "Re-check places: reached N of M — not reached: …". */
|
|
124
|
+
export declare function printRevisit(r: RevisitReport): void;
|
|
125
|
+
/**
|
|
126
|
+
* Print the delta against this scenario's previous completed run. Its
|
|
127
|
+
* counts are relative to that one run — "new" here means "not in that
|
|
128
|
+
* run", which is not the matcher's "first seen" (never recorded before)
|
|
129
|
+
* — so the heading says what it compares with.
|
|
130
|
+
*/
|
|
131
|
+
export declare function printVerification(verification: VerificationSummary): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { readEntity } from "@iamu-dev/local-store";
|
|
2
|
+
import type { EntityType, ProjectConfig } from "@iamu-dev/protocol";
|
|
3
|
+
export interface ProjectContext {
|
|
4
|
+
projectRoot: string;
|
|
5
|
+
config: ProjectConfig;
|
|
6
|
+
}
|
|
7
|
+
export interface CloudContext extends ProjectContext {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
apiUrl: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function commandError(message: string, opts?: {
|
|
12
|
+
json?: boolean | string;
|
|
13
|
+
}): void;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a run directory, reporting an unusable run id as a command
|
|
16
|
+
* error (message + exit code 1) instead of letting it reach the
|
|
17
|
+
* filesystem. Returns `null` once the error has been reported.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveRunDir(projectRoot: string, runId: string, opts?: {
|
|
20
|
+
json?: boolean;
|
|
21
|
+
}): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Last-resort handler for a rejection that escaped a command action.
|
|
24
|
+
* Prints one line — JSON-shaped when the invocation carried `--json` —
|
|
25
|
+
* and leaves a non-zero exit code behind. Without it, Commander's
|
|
26
|
+
* `parseAsync()` rejection reaches Node as an unhandled rejection: a
|
|
27
|
+
* stack trace at the user, and historically exit code 0.
|
|
28
|
+
*
|
|
29
|
+
* @param err - The value the command rejected with.
|
|
30
|
+
* @param argv - Invocation argv; only `--json` is read from it.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* await program.parseAsync().catch(reportFatalError);
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function reportFatalError(err: unknown, argv?: readonly string[]): void;
|
|
38
|
+
export declare function resolveProject(opts?: {
|
|
39
|
+
json?: boolean | string;
|
|
40
|
+
}): Promise<ProjectContext | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Resolves both project context and run directory path.
|
|
43
|
+
* Returns null if either fails (error already reported).
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveProjectAndRunDir(runId: string, opts?: {
|
|
46
|
+
cwd?: string;
|
|
47
|
+
json?: boolean;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
projectRoot: string;
|
|
50
|
+
config: ProjectConfig;
|
|
51
|
+
runDirPath: string;
|
|
52
|
+
} | null>;
|
|
53
|
+
export declare function resolveCloudProject(opts?: {
|
|
54
|
+
json?: boolean | string;
|
|
55
|
+
}): Promise<CloudContext | null>;
|
|
56
|
+
export declare function safeReadEntity<T extends object = Record<string, unknown>>(projectRoot: string, type: EntityType, slug: string, opts?: {
|
|
57
|
+
json?: boolean | string;
|
|
58
|
+
}): Promise<Awaited<ReturnType<typeof readEntity<T>>> | null>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { IamuConfigError } from "@iamu-dev/protocol";
|
|
2
|
+
/**
|
|
3
|
+
* Production API URL, used when neither a flag, `IAMU_API_URL`, nor the
|
|
4
|
+
* project config names one.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const url = config.cloud_api_url ?? DEFAULT_API_URL;
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_API_URL = "https://api.iamu.dev";
|
|
12
|
+
/**
|
|
13
|
+
* Stored credentials, keyed by API URL. Values are left `unknown` on
|
|
14
|
+
* purpose: the file is user-editable, so every reader narrows.
|
|
15
|
+
*/
|
|
16
|
+
export type CredentialsStore = Record<string, unknown>;
|
|
17
|
+
/**
|
|
18
|
+
* Absolute path of the credentials file (`~/.iamu/credentials.json`).
|
|
19
|
+
*
|
|
20
|
+
* @returns The path; the file may not exist yet.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* console.log(`Tokens live in ${getCredentialsPath()}`);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function getCredentialsPath(): string;
|
|
28
|
+
/**
|
|
29
|
+
* The API URL a command talks to: the configured one (project config
|
|
30
|
+
* or flag), else `IAMU_API_URL`, else {@link DEFAULT_API_URL}. Empty
|
|
31
|
+
* strings count as unset.
|
|
32
|
+
*
|
|
33
|
+
* @param configured - URL from project config or a flag, if any.
|
|
34
|
+
* @returns The effective API URL.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const apiUrl = resolveApiUrl(config.cloud_api_url);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveApiUrl(configured?: string | null): string;
|
|
42
|
+
/**
|
|
43
|
+
* The credentials file exists but is not a JSON object. Reported instead
|
|
44
|
+
* of being treated as empty: the next login would otherwise overwrite
|
|
45
|
+
* every stored token without a word.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* try {
|
|
50
|
+
* await readCredentialsStore();
|
|
51
|
+
* } catch (err) {
|
|
52
|
+
* if (err instanceof CredentialsFileError) console.error(err.message);
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare class CredentialsFileError extends IamuConfigError {
|
|
57
|
+
/**
|
|
58
|
+
* @param path - The unreadable credentials file.
|
|
59
|
+
* @param reason - What is wrong with it.
|
|
60
|
+
* @param cause - Underlying parse error, if any.
|
|
61
|
+
*/
|
|
62
|
+
constructor(path: string, reason: string, cause?: unknown);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Read the whole credentials store. A missing file is an empty store; a
|
|
66
|
+
* corrupt one throws {@link CredentialsFileError} so no caller writes
|
|
67
|
+
* over tokens it could not read.
|
|
68
|
+
*
|
|
69
|
+
* @returns The parsed store.
|
|
70
|
+
* @throws {@link CredentialsFileError} when the file is not a JSON object.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const store = await readCredentialsStore();
|
|
75
|
+
* delete store["https://api.iamu.dev"];
|
|
76
|
+
* await writeCredentialsStore(store);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function readCredentialsStore(): Promise<CredentialsStore>;
|
|
80
|
+
/**
|
|
81
|
+
* Replace the credentials store. Written to a temp file with mode 0600
|
|
82
|
+
* and renamed into place, so a crash mid-write leaves the previous file
|
|
83
|
+
* intact and the tokens are never world-readable, even briefly. The
|
|
84
|
+
* parent directory is created with mode 0700.
|
|
85
|
+
*
|
|
86
|
+
* @param store - The full store to persist.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const store = await readCredentialsStore();
|
|
91
|
+
* store[apiUrl] = { token, createdAt: new Date().toISOString() };
|
|
92
|
+
* await writeCredentialsStore(store);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function writeCredentialsStore(store: CredentialsStore): Promise<void>;
|
|
96
|
+
/** @internal Reset warned flag for unit testing. */
|
|
97
|
+
export declare function _resetWarnedUnreadableStoreForTesting(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Token for `apiUrl`: `IAMU_TOKEN`, then `IAMU_API_KEY`, then the entry
|
|
100
|
+
* for that URL in the credentials file. A corrupt credentials file is
|
|
101
|
+
* reported once on stderr (with the recovery step) and treated as no
|
|
102
|
+
* token.
|
|
103
|
+
*
|
|
104
|
+
* Synchronous because it sits on hot paths (MCP tool handlers, status).
|
|
105
|
+
*
|
|
106
|
+
* @param apiUrl - API URL the token must belong to; defaults via
|
|
107
|
+
* {@link resolveApiUrl}.
|
|
108
|
+
* @returns The token, or `null` when none is available.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const token = resolveApiKey(config.cloud_api_url);
|
|
113
|
+
* if (!token) console.error("Run iamu auth login");
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function resolveApiKey(apiUrl?: string | null): string | null;
|
|
117
|
+
/**
|
|
118
|
+
* True for hostnames that never leave the machine.
|
|
119
|
+
*
|
|
120
|
+
* @param hostname - `URL.hostname` (IPv6 arrives bracketed).
|
|
121
|
+
* @returns Whether the host is loopback.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* isLoopbackHost(new URL("http://[::1]:3000").hostname); // true
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare function isLoopbackHost(hostname: string): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Refuse an API URL that would send the bearer token in cleartext:
|
|
131
|
+
* anything but `https://`, except plain `http://` to a loopback host
|
|
132
|
+
* (the local cloud stack).
|
|
133
|
+
*
|
|
134
|
+
* @param url - Candidate API URL.
|
|
135
|
+
* @param source - Where it came from, for the error (`--url`,
|
|
136
|
+
* `IAMU_API_URL`, ...).
|
|
137
|
+
* @throws {@link IamuValidationError} when the URL is malformed or insecure.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* assertSecureApiUrl(process.env.IAMU_API_URL ?? DEFAULT_API_URL, "IAMU_API_URL");
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export declare function assertSecureApiUrl(url: string, source: string): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OutlineFrontmatter, ScenarioFrontmatter } from "@iamu-dev/protocol";
|
|
2
|
+
export interface ChangedFilesResult {
|
|
3
|
+
baseRef: string;
|
|
4
|
+
files: string[];
|
|
5
|
+
}
|
|
6
|
+
/** Resolve changed files against a git base ref (e.g. origin/main, HEAD~1). */
|
|
7
|
+
export declare function getChangedFiles(projectRoot: string, explicitRef?: string | boolean): ChangedFilesResult | null;
|
|
8
|
+
/** Extract matching tokens from a scenario and its outline. */
|
|
9
|
+
export declare function extractScenarioKeywords(scenario: ScenarioFrontmatter, outline?: OutlineFrontmatter): string[];
|
|
10
|
+
/** Checks whether any changed file matches the scenario's keywords or path. */
|
|
11
|
+
export declare function matchesChangedFiles(changedFiles: string[], scenario: ScenarioFrontmatter, outline?: OutlineFrontmatter): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface DoctorCheck {
|
|
2
|
+
category: "runtime" | "browser" | "project" | "agent" | "cloud";
|
|
3
|
+
name: string;
|
|
4
|
+
status: "ok" | "warn" | "error";
|
|
5
|
+
message: string;
|
|
6
|
+
remedy?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DoctorResult {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
checks: DoctorCheck[];
|
|
11
|
+
summary: {
|
|
12
|
+
ok: number;
|
|
13
|
+
warn: number;
|
|
14
|
+
error: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Check if a TCP port is available or bound */
|
|
18
|
+
export declare function checkPortAvailable(port: number): Promise<boolean>;
|
|
19
|
+
/** Check CDP responsiveness on a port */
|
|
20
|
+
export declare function checkCdpResponsive(port: number): Promise<boolean>;
|
|
21
|
+
export declare function runDoctorChecks(projectRoot?: string): Promise<DoctorResult>;
|
|
22
|
+
export declare function doctor(opts?: {
|
|
23
|
+
json?: boolean;
|
|
24
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type CanonicalWalkthrough } from "@iamu-dev/protocol";
|
|
2
|
+
/** What `verdicts.json` holds, as far as the report needs it. */
|
|
3
|
+
export interface RecordedVerdicts {
|
|
4
|
+
verdicts: Array<{
|
|
5
|
+
human_test_id: string;
|
|
6
|
+
verdict: string;
|
|
7
|
+
reasoning: string;
|
|
8
|
+
grounding_step_ids: string[];
|
|
9
|
+
grounding_finding_ids: string[];
|
|
10
|
+
}>;
|
|
11
|
+
overall?: {
|
|
12
|
+
answer: string;
|
|
13
|
+
reasoning: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A copy of `canonical` with the judge's verdicts filled in. canonical.json
|
|
18
|
+
* itself never carries them (its writer is `complete`); the report does.
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyVerdicts(canonical: CanonicalWalkthrough, recorded: RecordedVerdicts): CanonicalWalkthrough;
|
|
21
|
+
export declare function evaluate(runId: string, opts?: {
|
|
22
|
+
json?: boolean;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
export declare function evaluateRecord(runId: string, opts: {
|
|
25
|
+
file: string;
|
|
26
|
+
json?: boolean;
|
|
27
|
+
yes?: boolean;
|
|
28
|
+
prompt?: boolean;
|
|
29
|
+
view?: boolean;
|
|
30
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type GuidanceRule, type RevisitPlace } from "@iamu-dev/local-store";
|
|
2
|
+
import { type RunViewport } from "@iamu-dev/protocol";
|
|
3
|
+
/** "The browser is sized as a phone screen, 390×844." */
|
|
4
|
+
export declare function viewportLine(v: RunViewport): string;
|
|
5
|
+
interface WalkerPromptParts {
|
|
6
|
+
targetUrl: string | null;
|
|
7
|
+
persona: {
|
|
8
|
+
name: string;
|
|
9
|
+
role: string;
|
|
10
|
+
disposition: string | null;
|
|
11
|
+
background: string | null;
|
|
12
|
+
};
|
|
13
|
+
outline: {
|
|
14
|
+
title: string;
|
|
15
|
+
tension: unknown;
|
|
16
|
+
narrative: unknown;
|
|
17
|
+
};
|
|
18
|
+
brief: string | null;
|
|
19
|
+
access: {
|
|
20
|
+
project: string | null;
|
|
21
|
+
persona: string | null;
|
|
22
|
+
};
|
|
23
|
+
methodology: string;
|
|
24
|
+
dismissed: string[];
|
|
25
|
+
/** Active tester guidance in the scenario's scope. */
|
|
26
|
+
guidance?: GuidanceRule[];
|
|
27
|
+
/** Where fixes awaiting a re-run were seen — places only, no findings. */
|
|
28
|
+
revisit?: RevisitPlace[];
|
|
29
|
+
scenarioSlug: string;
|
|
30
|
+
runId: string;
|
|
31
|
+
runDirPath: string;
|
|
32
|
+
projectRoot: string;
|
|
33
|
+
surface: string;
|
|
34
|
+
/** The run's viewport (`start-run`, from persona tags), if any. */
|
|
35
|
+
viewport?: RunViewport | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The places-to-pass-through section: where this scenario's fixes
|
|
39
|
+
* awaiting a re-run were observed, framed as part of the persona's own
|
|
40
|
+
* route. It carries URLs and screen names only — never a finding's
|
|
41
|
+
* title, type, severity or any hint of what was wrong, so the walker
|
|
42
|
+
* judges each place fresh (the same reason it never sees human tests).
|
|
43
|
+
* Empty when nothing awaits, so those prompts stay as they were.
|
|
44
|
+
*/
|
|
45
|
+
export declare function revisitSection(places: readonly RevisitPlace[]): string[];
|
|
46
|
+
/**
|
|
47
|
+
* The walker subagent's whole prompt — persona, situation, brief, access,
|
|
48
|
+
* driving surface, methodology, and the run-directory contract (steps,
|
|
49
|
+
* screenshots, findings, summary.json). Composed here so every host
|
|
50
|
+
* hands its walker the same thing instead of assembling it by hand.
|
|
51
|
+
*/
|
|
52
|
+
export declare function composeWalkerPrompt(p: WalkerPromptParts): string;
|
|
53
|
+
export declare function instructionsWalk(opts: {
|
|
54
|
+
scenario: string;
|
|
55
|
+
run?: string;
|
|
56
|
+
surface?: string;
|
|
57
|
+
json?: boolean;
|
|
58
|
+
}): Promise<void>;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Print the matcher's input bundle: this run's findings, the scenario's
|
|
3
|
+
* earlier canonical findings, this run's steps, and the prompt.
|
|
4
|
+
*/
|
|
5
|
+
export declare function match(runId: string, opts?: {
|
|
6
|
+
json?: boolean;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
/** Record the matcher's answer and re-derive the run's delta and report. */
|
|
9
|
+
export declare function matchRecord(runId: string, opts: {
|
|
10
|
+
file: string;
|
|
11
|
+
json?: boolean;
|
|
12
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write or update the `iamu-sync` entry in an MCP config file.
|
|
3
|
+
* Merges with existing content — does not clobber other servers.
|
|
4
|
+
* Throws if existing file contains invalid JSON (avoids silent data loss).
|
|
5
|
+
*/
|
|
6
|
+
export declare function writeSyncMcpEntry(mcpPath: string): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Check if an MCP config file has an `iamu-sync` entry.
|
|
9
|
+
*/
|
|
10
|
+
export declare function hasSyncMcpEntry(parsed: Record<string, unknown>, mcpPath: string): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface NewEntityOptions {
|
|
2
|
+
name: string;
|
|
3
|
+
slug?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
role?: string;
|
|
6
|
+
disposition?: string;
|
|
7
|
+
outline?: string;
|
|
8
|
+
persona?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
authority?: string;
|
|
11
|
+
/** Scenario start path, e.g. /en/episodes/1. */
|
|
12
|
+
entry?: string;
|
|
13
|
+
json?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function newEntity(type: string, opts: NewEntityOptions): Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface NewFindingOptions {
|
|
2
|
+
scenario?: string;
|
|
3
|
+
run?: string;
|
|
4
|
+
title: string;
|
|
5
|
+
type: string;
|
|
6
|
+
severity: string;
|
|
7
|
+
uiFact?: string;
|
|
8
|
+
consequence?: string;
|
|
9
|
+
lens?: string;
|
|
10
|
+
uxHeuristic?: string;
|
|
11
|
+
/** What the finding does to the persona's task (blocks … enables). */
|
|
12
|
+
taskImpact?: string;
|
|
13
|
+
/** How sure the walker is that this is real (high | medium | low). */
|
|
14
|
+
confidence?: string;
|
|
15
|
+
/** Step number whose screenshot shows the finding. */
|
|
16
|
+
step?: string;
|
|
17
|
+
json?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function newFinding(opts: NewFindingOptions): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface OpenOptions {
|
|
2
|
+
printOnly?: boolean;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Opens the Iamu Cloud dashboard for the project or a specific walkthrough run.
|
|
6
|
+
* If the project is not cloud-linked, prompts the user to link or view the terminal summary.
|
|
7
|
+
*/
|
|
8
|
+
export declare function openDashboard(runId?: string, opts?: OpenOptions): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commander coercer for `--port`. Commander calls a coercer as
|
|
3
|
+
* `(value, previous)`, so a bare `parseInt` took the previous value as
|
|
4
|
+
* its radix — reinterpreting the digits — and silently truncated
|
|
5
|
+
* anything non-numeric instead of rejecting it.
|
|
6
|
+
*
|
|
7
|
+
* @param value - Raw option text from the command line.
|
|
8
|
+
* @returns The port as an integer in `0..65535`.
|
|
9
|
+
* @throws InvalidArgumentError when `value` is not such an integer.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* parsePortOption("8080"); // 8080
|
|
14
|
+
* parsePortOption("abc"); // throws InvalidArgumentError
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function parsePortOption(value: string, _previous?: unknown): number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PruneResult } from "@iamu-dev/local-store";
|
|
2
|
+
export interface PruneCliOptions {
|
|
3
|
+
keep?: string | number;
|
|
4
|
+
days?: string | number;
|
|
5
|
+
screenshotsOnly?: boolean;
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
yes?: boolean;
|
|
8
|
+
json?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function formatBytes(bytes: number): string;
|
|
11
|
+
export declare function prune(opts?: PruneCliOptions): Promise<PruneResult | undefined>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Registers walkthrough execution commands: start-run, instructions, browse, step, new-finding, complete, match, match-record, evaluate, evaluate-record, prune.
|
|
4
|
+
*/
|
|
5
|
+
export declare function registerWalkthroughCommands(program: Command): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { registerCloudCommands } from "./register-cloud.js";
|
|
3
|
+
import { registerFindingsCommands } from "./register-findings.js";
|
|
4
|
+
import { registerProjectCommands } from "./register-project.js";
|
|
5
|
+
import { registerWalkthroughCommands } from "./register-walkthrough.js";
|
|
6
|
+
/**
|
|
7
|
+
* Registers all CLI command groups onto the root Commander program.
|
|
8
|
+
*/
|
|
9
|
+
export declare function registerAllCommands(program: Command): void;
|
|
10
|
+
export { registerProjectCommands, registerWalkthroughCommands, registerFindingsCommands, registerCloudCommands, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ServeOptions {
|
|
2
|
+
/**
|
|
3
|
+
* `false` (from `--no-open`) prints the dashboard URL instead of
|
|
4
|
+
* launching a browser, like `iamu open --print`.
|
|
5
|
+
*/
|
|
6
|
+
open?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Deprecated: The local web UI has been retired in favor of Iamu Cloud and terminal reporting.
|
|
10
|
+
*/
|
|
11
|
+
export declare function serve(opts?: ServeOptions): Promise<void>;
|