autokap 1.8.7 → 1.8.8

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.
@@ -1,15 +1,9 @@
1
- // CLI-local config helpers.
1
+ // CLI-local config helpers. Self-contained, canonical implementation for the
2
+ // bundled CLI binary.
2
3
  //
3
- // NOTE: this file currently duplicates the canonical implementation in
4
- // `@autokap/core/config`. The MCP server consumes the core package directly;
5
- // the bundled CLI binary still ships a self-contained copy because
6
- // `@autokap/core` is not yet published to npm. Once core@0.1.0 is on the
7
- // registry and the published CLI bumps to declare it as a runtime dep, this
8
- // file can become a thin re-export shim (just LOCAL_WS_URL + requireConfig).
9
- //
10
- // Hardening here must stay in lockstep with packages/core/src/config.ts:
11
- // atomic writes, scheme allowlist on URL inputs, env-var precedence, and
12
- // the "untrusted origin override" guard.
4
+ // Security invariants to preserve when editing: atomic writes, scheme
5
+ // allowlist on URL inputs, env-var precedence, and the "untrusted origin
6
+ // override" guard.
13
7
  import path from 'node:path';
14
8
  import os from 'node:os';
15
9
  import crypto from 'node:crypto';
@@ -131,7 +125,8 @@ export async function writeConfig(config) {
131
125
  ? { exportDebugLogs: config.exportDebugLogs }
132
126
  : {}),
133
127
  };
134
- // Atomic write see packages/core/src/config.ts for the canonical impl.
128
+ // Atomic write: write to a temp file then rename, so a crash mid-write
129
+ // never leaves a truncated config.
135
130
  const tmpPath = `${configPath}.${process.pid}.${crypto.randomBytes(4).toString('hex')}.tmp`;
136
131
  try {
137
132
  await fs.writeFile(tmpPath, JSON.stringify(normalizedConfig, null, 2), 'utf-8');
@@ -18,15 +18,6 @@ export declare const CLI_DEFAULT_INSTALL_COMMAND = "npx -y autokap@latest";
18
18
  export declare const CLI_DEFAULT_INSTALLED_SETUP_COMMAND = "autokap login <your-api-key>";
19
19
  export declare const CLI_DEFAULT_SETUP_COMMAND = "npx -y autokap@latest login <your-api-key>";
20
20
  export declare const CLI_FALLBACK_PROGRAM_COMMAND = "autokap run <preset-id> --program <file>";
21
- /** Bare MCP runner. Used by generic clients and as the npx command. */
22
- export declare const MCP_INSTALL_COMMAND = "npx -y @autokap/mcp";
23
- /** One-shot install command for Claude Code (CLI flag `claude mcp add`). */
24
- export declare const MCP_CLAUDE_CODE_COMMAND = "claude mcp add autokap -- npx -y @autokap/mcp";
25
- /**
26
- * JSON snippet to merge into the IDE-specific MCP config file (Cursor, Codex,
27
- * Windsurf, Cline...). Format follows the shared `mcpServers` schema.
28
- */
29
- export declare const MCP_CONFIG_SNIPPET_JSON: string;
30
21
  export declare function buildCliRunCommand(presetId: string, options?: {
31
22
  local?: boolean;
32
23
  env?: string;
@@ -8,47 +8,20 @@ export const CLI_KEY_TERM = API_KEY_TERM;
8
8
  export const CLI_VERSION_HEADER = "x-autokap-cli-version";
9
9
  export const MIN_CLI_VERSION_FOR_SIGNED_PROGRAMS = "1.0.9";
10
10
  export const MIN_CLI_VERSION_FOR_DIRECT_ARTIFACT_UPLOADS = "1.5.0";
11
- // MCP-first install. The bundled CLI binary ships only for CI / Cloud Run;
12
- // recommend `npx -y autokap@latest` over a global install to keep version
13
- // drift contained and avoid the npm supply-chain anxiety the migration was
14
- // designed to remove. The `CLI_DEFAULT_INSTALL_COMMAND` alias is retained for
15
- // legacy doc surfaces that still want a single shell snippet.
11
+ // The bundled CLI binary ships for CI / Cloud Run and for running preset
12
+ // captures locally; recommend `npx -y autokap@latest` over a global install to
13
+ // keep version drift contained. The `CLI_DEFAULT_INSTALL_COMMAND` alias is the
14
+ // single shell snippet doc surfaces reference.
16
15
  export const CLI_DEFAULT_INSTALL_COMMAND = "npx -y autokap@latest";
17
16
  // `autokap init` was removed in v2. The setup command now uses the surviving
18
17
  // `autokap login` for the same purpose (store the API key in ~/.autokap/config.json).
19
- // MCP-first workflows should use `autokap_authenticate` from the IDE instead.
20
18
  export const CLI_DEFAULT_INSTALLED_SETUP_COMMAND = "autokap login <your-api-key>";
21
19
  export const CLI_DEFAULT_SETUP_COMMAND = "npx -y autokap@latest login <your-api-key>";
22
- // `autokap skill --agent` was removed in v2. The skill ships as the MCP resource
23
- // `autokap://skill/preset-spec` (or `autokap_get_skill` tool fallback). The
24
- // legacy `CLI_ADVANCED_SKILL_COMMAND` constant that pointed at the removed
25
- // command was dropped entirely — it had no consumers and any future doc page
26
- // surfacing it would mislead users into typing a non-existent command.
20
+ // `autokap skill --agent` was removed in v2. The legacy `CLI_ADVANCED_SKILL_COMMAND`
21
+ // constant that pointed at the removed command was dropped entirely — it had no
22
+ // consumers and any future doc page surfacing it would mislead users into typing
23
+ // a non-existent command.
27
24
  export const CLI_FALLBACK_PROGRAM_COMMAND = "autokap run <preset-id> --program <file>";
28
- // ── MCP-first install contract ──────────────────────────────────────
29
- //
30
- // AutoKap is primarily exposed as a Model Context Protocol server via the
31
- // `@autokap/mcp` package. Every supported IDE installs the server by adding a
32
- // single stdio entry that runs `npx -y @autokap/mcp` — the constants below
33
- // are the canonical shell forms used across onboarding surfaces (wizard,
34
- // modal, banner, docs). For per-IDE payloads (config paths, snippets, notes),
35
- // use `getMcpInstallEntries()` from `web/lib/site-discovery.ts`.
36
- /** Bare MCP runner. Used by generic clients and as the npx command. */
37
- export const MCP_INSTALL_COMMAND = "npx -y @autokap/mcp";
38
- /** One-shot install command for Claude Code (CLI flag `claude mcp add`). */
39
- export const MCP_CLAUDE_CODE_COMMAND = "claude mcp add autokap -- npx -y @autokap/mcp";
40
- /**
41
- * JSON snippet to merge into the IDE-specific MCP config file (Cursor, Codex,
42
- * Windsurf, Cline...). Format follows the shared `mcpServers` schema.
43
- */
44
- export const MCP_CONFIG_SNIPPET_JSON = JSON.stringify({
45
- mcpServers: {
46
- autokap: {
47
- command: "npx",
48
- args: ["-y", "@autokap/mcp"],
49
- },
50
- },
51
- }, null, 2);
52
25
  export function buildCliRunCommand(presetId, options = {}) {
53
26
  const flags = [
54
27
  options.local ? " --local" : "",
@@ -65,19 +38,19 @@ export const CLI_PUBLIC_COMMANDS = [
65
38
  {
66
39
  id: "login",
67
40
  command: "autokap login <key>",
68
- summary: "Authenticate with your API key (used by Cloud Run + CI; from the IDE, call autokap_authenticate via MCP instead)",
41
+ summary: "Authenticate with your API key (used by Cloud Run + CI and for local preset runs)",
69
42
  docsDescriptionKey: "cliCmdLogin",
70
43
  },
71
44
  {
72
45
  id: "run",
73
46
  command: "autokap run <preset-id> --env local",
74
- summary: "Run a preset capture using local Playwright (also spawned by autokap_start_capture from the MCP server)",
47
+ summary: "Run a preset capture using local Playwright",
75
48
  docsDescriptionKey: "cliCmdRun",
76
49
  },
77
50
  {
78
51
  id: "auto-recapture",
79
52
  command: "autokap auto-recapture --project <project-id> --env local",
80
- summary: "Run every preset enabled for Recapture Cloud in a project (the canonical surface for Cloud Run + CI; MCP exposes autokap_start_auto_recapture for end users)",
53
+ summary: "Run every preset enabled for Recapture Cloud in a project (the canonical surface for Cloud Run + CI)",
81
54
  docsDescriptionKey: "cliCmdAutoRecapture",
82
55
  },
83
56
  {
package/dist/cli.js CHANGED
@@ -120,9 +120,9 @@ program
120
120
  logger.success(`Authenticated. Key stored in ${getConfigPath()}`);
121
121
  process.exit(0);
122
122
  });
123
- // Auth commands (whoami / logout / ping) live in @autokap/mcp; this binary keeps
124
- // `login` only for CI / Cloud Run. Local dev can still inspect the config via
125
- // `autokap doctor` or `cat ~/.autokap/config.json`.
123
+ // This binary keeps `login` only for CI / Cloud Run and local preset runs.
124
+ // Local dev can still inspect the config via `autokap doctor` or
125
+ // `cat ~/.autokap/config.json`.
126
126
  async function runOutdatedPresetsLocally(opts) {
127
127
  if (opts.output) {
128
128
  fatal('`--output` is not supported with `--outdated`; run an individual preset when local copies are needed.');
@@ -511,10 +511,10 @@ program
511
511
  });
512
512
  process.exit(0);
513
513
  });
514
- // Project, preset, capture, usage, video, auth, endpoints, skill, init, proxy,
515
- // and branding workflows live in @autokap/mcp. This binary exposes only the
516
- // commands needed by CI and Cloud Run (login / run / auto-recapture / doctor).
517
- // See MIGRATION-v1-to-v2.md for the CLI→MCP tool mapping (kept for older users).
514
+ // Project, preset, capture, usage, video, endpoints, proxy, and branding
515
+ // workflows are managed from the AutoKap web dashboard and GitHub PR
516
+ // generation. This binary exposes only the commands needed by CI, Cloud Run,
517
+ // and local preset runs (login / run / auto-recapture / doctor).
518
518
  // ── doctor command ──────────────────────────────────────────────────
519
519
  program
520
520
  .command('doctor')
@@ -1,5 +1,5 @@
1
1
  import type { SupabaseClient } from '@supabase/supabase-js';
2
- export type CreditUsageType = 'screenshot' | 'clip' | 'video' | 'cloud_recapture' | 'ai_chat' | 'studio_creation' | 'studio_iteration' | 'error_analysis' | 'obsolescence_analysis';
2
+ export type CreditUsageType = 'screenshot' | 'clip' | 'video' | 'cloud_recapture' | 'ai_chat' | 'studio_creation' | 'studio_iteration' | 'error_analysis' | 'obsolescence_analysis' | 'pr_generation';
3
3
  export declare function recordCreditUsage(supabase: SupabaseClient, params: {
4
4
  userId: string;
5
5
  projectId: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autokap",
3
- "version": "1.8.7",
3
+ "version": "1.8.8",
4
4
  "description": "AI-powered CLI tool for capturing clean screenshots of websites",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/readme.md CHANGED
@@ -3,21 +3,15 @@
3
3
  AI-powered website screenshot capture across every device, language, and
4
4
  theme.
5
5
 
6
- This npm package (`autokap`) is the **backend** consumed by:
7
-
8
- - the AutoKap Cloud Run service that handles
9
- `npx autokap auto-recapture --cloud` jobs, and
10
- - the official MCP server `@autokap/mcp`, which spawns the package as a
11
- sub-process for local capture execution (`autokap_start_capture`).
12
-
13
- **You probably do not need to install this package directly.** Wire your
14
- IDE assistant to `@autokap/mcp` instead — see the per-IDE install guides
15
- in the repository root README and the
16
- [migration guide](https://github.com/autokap/autokap/blob/main/MIGRATION-v1-to-v2.md).
17
-
18
- The advanced commands `autokap login`, `autokap run`, `autokap doctor`,
19
- and `autokap auto-recapture` remain available for users who need a
20
- scriptable backend (CI/CD, custom orchestrators).
6
+ This npm package (`autokap`) is the **backend** that runs the AutoKap capture
7
+ engine. It is consumed by the AutoKap Cloud Run service that handles
8
+ `npx autokap auto-recapture --cloud` jobs, by CI pipelines, and for local
9
+ preset runs.
10
+
11
+ The commands `autokap login`, `autokap run`, `autokap doctor`, and
12
+ `autokap auto-recapture` are available for users who need a scriptable backend
13
+ (CI/CD, custom orchestrators). Project, preset, and capture management happens
14
+ in the AutoKap web dashboard.
21
15
 
22
16
  ## Recapture Cloud in CI/CD
23
17