@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.
Files changed (80) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +103 -2
  3. package/dist/adapters/claude-plugin.d.ts +13 -0
  4. package/dist/adapters/registry.d.ts +6 -0
  5. package/dist/adapters/types.d.ts +19 -0
  6. package/dist/bin.d.ts +2 -0
  7. package/dist/bin.js +21005 -0
  8. package/dist/build-info.d.ts +53 -0
  9. package/dist/cloud-url.d.ts +19 -0
  10. package/dist/commands/auth-http.d.ts +37 -0
  11. package/dist/commands/auth-project-choice.d.ts +74 -0
  12. package/dist/commands/auth-token-input.d.ts +21 -0
  13. package/dist/commands/auth.d.ts +84 -0
  14. package/dist/commands/browse-actions.d.ts +56 -0
  15. package/dist/commands/browse-driver.d.ts +117 -0
  16. package/dist/commands/browse.d.ts +156 -0
  17. package/dist/commands/cloud-push.d.ts +27 -0
  18. package/dist/commands/complete.d.ts +131 -0
  19. package/dist/commands/completion.d.ts +2 -0
  20. package/dist/commands/context.d.ts +58 -0
  21. package/dist/commands/credentials.d.ts +144 -0
  22. package/dist/commands/diff-filter.d.ts +11 -0
  23. package/dist/commands/doctor.d.ts +24 -0
  24. package/dist/commands/evaluate.d.ts +30 -0
  25. package/dist/commands/findings.d.ts +7 -0
  26. package/dist/commands/init.d.ts +9 -0
  27. package/dist/commands/instructions-walk.d.ts +59 -0
  28. package/dist/commands/list.d.ts +5 -0
  29. package/dist/commands/match.d.ts +12 -0
  30. package/dist/commands/mcp-config.d.ts +10 -0
  31. package/dist/commands/new-entity.d.ts +15 -0
  32. package/dist/commands/new-finding.d.ts +19 -0
  33. package/dist/commands/open.d.ts +8 -0
  34. package/dist/commands/port.d.ts +17 -0
  35. package/dist/commands/prune.d.ts +11 -0
  36. package/dist/commands/pull.d.ts +5 -0
  37. package/dist/commands/register-cloud.d.ts +5 -0
  38. package/dist/commands/register-findings.d.ts +5 -0
  39. package/dist/commands/register-project.d.ts +5 -0
  40. package/dist/commands/register-walkthrough.d.ts +5 -0
  41. package/dist/commands/register.d.ts +10 -0
  42. package/dist/commands/report.d.ts +3 -0
  43. package/dist/commands/serve.d.ts +11 -0
  44. package/dist/commands/skills.d.ts +34 -0
  45. package/dist/commands/start-run.d.ts +49 -0
  46. package/dist/commands/status.d.ts +3 -0
  47. package/dist/commands/step-numbering.d.ts +87 -0
  48. package/dist/commands/step.d.ts +95 -0
  49. package/dist/commands/sync.d.ts +6 -0
  50. package/dist/commands/triage.d.ts +21 -0
  51. package/dist/commands/update.d.ts +4 -0
  52. package/dist/commands/validate.d.ts +8 -0
  53. package/dist/commands/view-results.d.ts +9 -0
  54. package/dist/index.d.ts +9 -0
  55. package/dist/index.js +20852 -0
  56. package/dist/sync-mcp/fatal.d.ts +42 -0
  57. package/dist/sync-mcp/server.d.ts +1 -0
  58. package/dist/sync-mcp/tools.d.ts +12 -0
  59. package/dist/templates/prompts/combine.md +69 -0
  60. package/dist/templates/prompts/complete.md +132 -0
  61. package/dist/templates/prompts/evaluate.md +64 -0
  62. package/dist/templates/prompts/outline.md +54 -0
  63. package/dist/templates/prompts/persona.md +40 -0
  64. package/dist/templates/prompts/walk.md +167 -0
  65. package/dist/templates/skills/iamu-findings.md +228 -0
  66. package/dist/templates/skills/iamu-new.md +206 -0
  67. package/dist/templates/skills/iamu-propose.md +124 -0
  68. package/dist/templates/skills/iamu-run.md +400 -0
  69. package/dist/templates/skills/iamu-setup.md +192 -0
  70. package/dist/templates/skills/iamu-status.md +64 -0
  71. package/dist/templates.d.ts +10 -0
  72. package/dist/ui/journey-diff.d.ts +3 -0
  73. package/dist/ui/json.d.ts +6 -0
  74. package/dist/ui/logger.d.ts +5 -0
  75. package/dist/ui/panic.d.ts +11 -0
  76. package/dist/ui/symbols.d.ts +11 -0
  77. package/dist/ui/table.d.ts +20 -0
  78. package/dist/ui/update-check.d.ts +6 -0
  79. package/dist/worktree-state.d.ts +49 -0
  80. package/package.json +69 -3
@@ -0,0 +1,34 @@
1
+ import type { HostAdapter, CommandContent } from "../adapters/types.js";
2
+ export declare function getVersion(): string;
3
+ export declare function loadSkillTemplates(version: string): Map<string, string>;
4
+ export declare function commandsFromSkills(templates: Map<string, string>): CommandContent[];
5
+ /**
6
+ * Hosts in `projectRoot` that already have iamu skills or commands
7
+ * installed — the ones `iamu update` refreshes.
8
+ */
9
+ export declare function detectInstalledHosts(projectRoot: string): HostAdapter[];
10
+ /**
11
+ * Resolves target hosts for install or update.
12
+ * If hostFilter is supplied, matches by value or name (case-insensitive).
13
+ * Otherwise combines already-installed hosts and detected editor hosts in the workspace.
14
+ */
15
+ export declare function resolveTargetHosts(projectRoot: string, hostFilter?: string): {
16
+ hosts: HostAdapter[];
17
+ error?: string;
18
+ };
19
+ /**
20
+ * Installed skill/command files that differ from what `iamu update` would
21
+ * write for this CLI version. Local reads only — no network.
22
+ *
23
+ * @returns Absolute paths of the stale files; empty when up to date or
24
+ * when no host has iamu skills installed.
25
+ */
26
+ export declare function findStaleSkills(projectRoot: string): Promise<string[]>;
27
+ /** The one-line nudge `iamu status` and `iamu sync` print. */
28
+ export declare const STALE_SKILLS_MESSAGE = "Skills are out of date \u2014 run `iamu update`";
29
+ export declare function installSkillsForHosts(hosts: HostAdapter[], projectRoot: string, version: string, opts?: {
30
+ quiet?: boolean;
31
+ }): Promise<{
32
+ totalSkills: number;
33
+ totalCommands: number;
34
+ }>;
@@ -0,0 +1,49 @@
1
+ import { type BuildMetadata, type RunViewport, type ScenarioFrontmatter } from "@iamu-dev/protocol";
2
+ /**
3
+ * The URL a run starts at: `--target` (or the scenario's `target_url`)
4
+ * as the base, with the scenario's `entry_path` resolved against it.
5
+ * Returns an error message instead when there is nothing usable.
6
+ */
7
+ export declare function resolveStartUrl(target: string | undefined, scenario: Pick<ScenarioFrontmatter, "target_url" | "entry_path">): {
8
+ url: string;
9
+ } | {
10
+ error: string;
11
+ };
12
+ /**
13
+ * Fast preflight probe to check if the target URL answers HTTP requests.
14
+ * Times out quickly (default: 1000ms) to avoid stalling walkthrough initialization.
15
+ */
16
+ export declare function checkTargetReachable(url: string, timeoutMs?: number): Promise<{
17
+ reachable: boolean;
18
+ error?: string;
19
+ }>;
20
+ /**
21
+ * The build as one line: label, branch, commit and CI provider. A dirty
22
+ * tree shows next to the commit, so a re-run after an uncommitted fix
23
+ * visibly walks a different build.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * formatBuild({ git_sha: "90e2444…", git_dirty: true, worktree_hash: "3fa9c1d2e4b5" });
28
+ * // "90e2444 + uncommitted changes (3fa9c1…)"
29
+ * ```
30
+ */
31
+ export declare function formatBuild(build: BuildMetadata): string;
32
+ /**
33
+ * A run viewport as one line.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * formatViewport({ device: "desktop", width: 1280, height: 800, source: "persona-tags" });
38
+ * // "desktop 1280×800 (from persona tags)"
39
+ * ```
40
+ */
41
+ export declare function formatViewport(v: RunViewport): string;
42
+ export interface StartRunOptions {
43
+ target?: string;
44
+ build?: string;
45
+ env?: string;
46
+ json?: boolean;
47
+ check?: boolean;
48
+ }
49
+ export declare function startRun(scenarioSlug: string, opts: StartRunOptions): Promise<void>;
@@ -0,0 +1,3 @@
1
+ export declare function status(opts: {
2
+ json?: boolean;
3
+ }): Promise<void>;
@@ -0,0 +1,87 @@
1
+ /**
2
+ * A step number claimed on disk. The file at `stepPath` exists (empty)
3
+ * until the caller overwrites it with the step, or calls `release()`.
4
+ *
5
+ * @public
6
+ */
7
+ export interface StepReservation {
8
+ /** The reserved 1-based step number. */
9
+ stepNumber: number;
10
+ /** Absolute path of the reserved `NNN.json`. */
11
+ stepPath: string;
12
+ /** Give the number back — removes the placeholder file. Never throws. */
13
+ release(): Promise<void>;
14
+ }
15
+ /**
16
+ * The file name for a step number: `7` → `"007.json"`.
17
+ *
18
+ * @param stepNumber - 1-based step number.
19
+ * @returns The zero-padded file name.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * stepFileName(7); // "007.json"
24
+ * ```
25
+ *
26
+ * @public
27
+ */
28
+ export declare function stepFileName(stepNumber: number): string;
29
+ /**
30
+ * The step-limit error message shared by `iamu step` and
31
+ * `iamu browse step`.
32
+ *
33
+ * @param maxSteps - The limit that was hit.
34
+ * @param runId - The run being recorded into.
35
+ * @returns A message naming the limit and both ways out.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * throw new Error(stepLimitMessage(50, runId));
40
+ * ```
41
+ *
42
+ * @public
43
+ */
44
+ export declare function stepLimitMessage(maxSteps: number, runId: string): string;
45
+ /**
46
+ * The number the next step would get (highest recorded + 1), without
47
+ * claiming it. Use for an early "would this exceed the limit?" check;
48
+ * only {@link reserveStepFile} makes the number yours.
49
+ *
50
+ * @param stepsDir - Absolute path of `<runDir>/steps`.
51
+ * @returns The next free step number (1 when the directory is empty or missing).
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * if ((await peekNextStepNumber(stepsDir)) > maxSteps) fail("limit");
56
+ * ```
57
+ *
58
+ * @public
59
+ */
60
+ export declare function peekNextStepNumber(stepsDir: string): Promise<number>;
61
+ /**
62
+ * Claim the next step number by exclusively creating its `NNN.json`.
63
+ * On `EEXIST` (another writer won that number) it moves to the next
64
+ * one, so N concurrent callers end up with N distinct files.
65
+ *
66
+ * @param stepsDir - Absolute path of `<runDir>/steps` (must exist).
67
+ * @param limit - `maxSteps` cap and the `runId` named in the error.
68
+ * @returns The reservation; overwrite `stepPath` with the step or `release()` it.
69
+ * @throws Error with {@link stepLimitMessage} when the next number exceeds `maxSteps`.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const r = await reserveStepFile(stepsDir, { maxSteps: 50, runId });
74
+ * try {
75
+ * await writeStep(runDir, { ...step, step_number: r.stepNumber });
76
+ * } catch (err) {
77
+ * await r.release();
78
+ * throw err;
79
+ * }
80
+ * ```
81
+ *
82
+ * @public
83
+ */
84
+ export declare function reserveStepFile(stepsDir: string, limit: {
85
+ maxSteps: number;
86
+ runId: string;
87
+ }): Promise<StepReservation>;
@@ -0,0 +1,95 @@
1
+ import { type RunStep } from "@iamu-dev/protocol";
2
+ /** Steps a run may record before the circuit breaker trips. */
3
+ export declare const DEFAULT_MAX_STEPS = 50;
4
+ /**
5
+ * The step limit to enforce: `val` (from `--max-steps`) when it is a
6
+ * positive integer, else `IAMU_MAX_STEPS`, else {@link DEFAULT_MAX_STEPS}.
7
+ *
8
+ * @param val - The raw `--max-steps` value, if any.
9
+ * @returns A positive step limit.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * parseMaxSteps("20"); // 20
14
+ * parseMaxSteps(undefined); // 50, unless IAMU_MAX_STEPS is set
15
+ * ```
16
+ *
17
+ * @public
18
+ */
19
+ export declare function parseMaxSteps(val?: string | number): number;
20
+ /** What {@link recordStep} records. */
21
+ export interface RecordStepInput {
22
+ projectRoot: string;
23
+ runId: string;
24
+ action: string;
25
+ note?: string | null;
26
+ /** Path of an existing screenshot to copy in; a missing file is an error. */
27
+ shot?: string | null;
28
+ url?: string | null;
29
+ surface?: string | null;
30
+ grounding?: string | null;
31
+ timestamp?: string;
32
+ maxSteps?: string | number;
33
+ extra?: Record<string, unknown>;
34
+ }
35
+ /** What {@link recordStep} wrote. */
36
+ export interface RecordStepResult {
37
+ step: RunStep;
38
+ stepPath: string;
39
+ screenshotPath: string | null;
40
+ }
41
+ /**
42
+ * Record a single step into `<runDir>/steps/NNN.json`.
43
+ *
44
+ * The step number is reserved with an exclusive create (see
45
+ * {@link reserveStepFile}), so concurrent calls get distinct numbers
46
+ * instead of overwriting each other; the content is then written
47
+ * atomically (temp file + rename). A `shot` is copied into
48
+ * `<runDir>/screenshots/step-N.png`; a `shot` that is not an existing
49
+ * file is an error — a step never points at a screenshot that is not there.
50
+ *
51
+ * @param input - The run, the action, and optional evidence.
52
+ * @returns The validated step, its file, and the copied screenshot path.
53
+ * @throws Error when the run is missing, `shot` is not a file, or the step limit is reached.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const { step } = await recordStep({
58
+ * projectRoot,
59
+ * runId,
60
+ * action: "Clicked checkout",
61
+ * shot: "./shot.png",
62
+ * });
63
+ * console.log(step.step_number);
64
+ * ```
65
+ *
66
+ * @public
67
+ */
68
+ export declare function recordStep(input: RecordStepInput): Promise<RecordStepResult>;
69
+ /** Options for `iamu step`. */
70
+ export interface StepOptions {
71
+ run?: string;
72
+ action: string;
73
+ note?: string;
74
+ shot?: string;
75
+ url?: string;
76
+ surface?: string;
77
+ grounding?: string;
78
+ maxSteps?: string | number;
79
+ json?: boolean;
80
+ }
81
+ /**
82
+ * `iamu step [run-id]` — record one step via {@link recordStep} and
83
+ * print it (one JSON document with `--json`). Errors set exit code 1.
84
+ *
85
+ * @param runArg - Positional run ID; falls back to `opts.run`.
86
+ * @param opts - Parsed CLI options.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * await stepCommand("run-123", { action: "Clicked checkout", json: true });
91
+ * ```
92
+ *
93
+ * @public
94
+ */
95
+ export declare function stepCommand(runArg: string | undefined, opts: StepOptions): Promise<void>;
@@ -0,0 +1,6 @@
1
+ export declare function sync(opts?: {
2
+ status?: boolean;
3
+ json?: boolean;
4
+ keepMine?: boolean;
5
+ confirmDeletes?: boolean;
6
+ }): Promise<void>;
@@ -0,0 +1,21 @@
1
+ export interface TriageOptions {
2
+ status: string;
3
+ /** Why — the triager's words. Required when dismissing. */
4
+ note?: string;
5
+ /** Dismiss reason: not_relevant | walker_error | duplicate. */
6
+ reason?: string;
7
+ /** Guidance rule text; defaults to "Don't report: <title>". */
8
+ rule?: string;
9
+ /** Where the guidance rule applies. Default: project. */
10
+ scope?: string;
11
+ /** `false` (`--no-guidance`): dismiss without writing a guidance rule. */
12
+ guidance?: boolean;
13
+ json?: boolean;
14
+ }
15
+ /**
16
+ * Set the triage status of one or more findings. Dismissing as
17
+ * `not_relevant` or `walker_error` also writes a tester guidance rule
18
+ * (`iamu/guidance/<slug>.md`) so later walks stop reporting the same
19
+ * thing; several findings dismissed together share one rule.
20
+ */
21
+ export declare function triage(refs: string[], opts: TriageOptions): Promise<void>;
@@ -0,0 +1,4 @@
1
+ export interface UpdateOptions {
2
+ host?: string;
3
+ }
4
+ export declare function update(opts?: UpdateOptions): Promise<void>;
@@ -0,0 +1,8 @@
1
+ export declare function validate(filePath: string | undefined, opts: {
2
+ run?: string;
3
+ all?: boolean;
4
+ type?: string;
5
+ json?: boolean;
6
+ fix?: boolean;
7
+ dryRun?: boolean;
8
+ }): Promise<void>;
@@ -0,0 +1,9 @@
1
+ export declare function openBrowserResults(projectRoot: string, runId?: string): Promise<void>;
2
+ export interface PromptViewResultsOptions {
3
+ prompt?: boolean;
4
+ yes?: boolean;
5
+ view?: boolean;
6
+ json?: boolean;
7
+ runId?: string;
8
+ }
9
+ export declare function promptViewResults(projectRoot: string, opts?: PromptViewResultsOptions): Promise<void>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * \@iamu-dev/iamu
3
+ *
4
+ * Scenario-driven development — test your product as realistic personas.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ export { registerAllCommands } from "./commands/register.js";
9
+ export { setupProcessHandlers, registerSigintCleanup } from "./ui/panic.js";