@agent-watch-ai/edge 0.2.5
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/CHANGELOG.md +251 -0
- package/LICENSE +21 -0
- package/README.md +168 -0
- package/dist/billing/billing-mode.d.ts +16 -0
- package/dist/billing/billing-mode.js +139 -0
- package/dist/billing/constants/billing.constants.d.ts +37 -0
- package/dist/billing/constants/billing.constants.js +38 -0
- package/dist/billing/index.d.ts +6 -0
- package/dist/billing/index.js +6 -0
- package/dist/cli/args.d.ts +29 -0
- package/dist/cli/args.js +61 -0
- package/dist/cli/constants/cli.constants.d.ts +60 -0
- package/dist/cli/constants/cli.constants.js +60 -0
- package/dist/cli/context.d.ts +51 -0
- package/dist/cli/context.js +108 -0
- package/dist/cli/doctor.d.ts +15 -0
- package/dist/cli/doctor.js +416 -0
- package/dist/cli/hook.d.ts +20 -0
- package/dist/cli/hook.js +166 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.js +8 -0
- package/dist/cli/misc.d.ts +31 -0
- package/dist/cli/misc.js +63 -0
- package/dist/cli/setup.d.ts +32 -0
- package/dist/cli/setup.js +298 -0
- package/dist/cli/status.d.ts +11 -0
- package/dist/cli/status.js +174 -0
- package/dist/cli/types/cli.types.d.ts +69 -0
- package/dist/cli/types/cli.types.js +1 -0
- package/dist/cli/ui.d.ts +41 -0
- package/dist/cli/ui.js +78 -0
- package/dist/cli/uninstall.d.ts +13 -0
- package/dist/cli/uninstall.js +83 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +124 -0
- package/dist/config/config-store.d.ts +29 -0
- package/dist/config/config-store.js +75 -0
- package/dist/config/config.d.ts +73 -0
- package/dist/config/config.js +115 -0
- package/dist/config/constants/config.constants.d.ts +62 -0
- package/dist/config/constants/config.constants.js +70 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.js +5 -0
- package/dist/config/repo-config.d.ts +37 -0
- package/dist/config/repo-config.js +178 -0
- package/dist/config/schemas/config.schema.d.ts +409 -0
- package/dist/config/schemas/config.schema.js +97 -0
- package/dist/config/types/config.types.d.ts +33 -0
- package/dist/config/types/config.types.js +1 -0
- package/dist/core/async.d.ts +20 -0
- package/dist/core/async.js +32 -0
- package/dist/core/constants/core.constants.d.ts +18 -0
- package/dist/core/constants/core.constants.js +18 -0
- package/dist/core/env.d.ts +12 -0
- package/dist/core/env.js +20 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +8 -0
- package/dist/core/logger.d.ts +27 -0
- package/dist/core/logger.js +82 -0
- package/dist/core/number.d.ts +33 -0
- package/dist/core/number.js +47 -0
- package/dist/core/object.d.ts +78 -0
- package/dist/core/object.js +127 -0
- package/dist/core/pipe.d.ts +55 -0
- package/dist/core/pipe.js +81 -0
- package/dist/core/types/core.types.d.ts +54 -0
- package/dist/core/types/core.types.js +4 -0
- package/dist/core/version.d.ts +19 -0
- package/dist/core/version.js +35 -0
- package/dist/core/which.d.ts +13 -0
- package/dist/core/which.js +57 -0
- package/dist/enforcement/constants/enforcement.constants.d.ts +23 -0
- package/dist/enforcement/constants/enforcement.constants.js +22 -0
- package/dist/enforcement/decision-cache.d.ts +57 -0
- package/dist/enforcement/decision-cache.js +138 -0
- package/dist/enforcement/decision-client.d.ts +14 -0
- package/dist/enforcement/decision-client.js +84 -0
- package/dist/enforcement/enforcement.d.ts +17 -0
- package/dist/enforcement/enforcement.js +90 -0
- package/dist/enforcement/index.d.ts +11 -0
- package/dist/enforcement/index.js +10 -0
- package/dist/enforcement/schemas/enforcement.schema.d.ts +30 -0
- package/dist/enforcement/schemas/enforcement.schema.js +36 -0
- package/dist/enforcement/types/enforcement.types.d.ts +59 -0
- package/dist/enforcement/types/enforcement.types.js +1 -0
- package/dist/enrollment/constants/enrollment.constants.d.ts +6 -0
- package/dist/enrollment/constants/enrollment.constants.js +6 -0
- package/dist/enrollment/enrollment-provider.d.ts +5 -0
- package/dist/enrollment/enrollment-provider.js +1 -0
- package/dist/enrollment/index.d.ts +7 -0
- package/dist/enrollment/index.js +1 -0
- package/dist/enrollment/manual-enrollment.d.ts +32 -0
- package/dist/enrollment/manual-enrollment.js +72 -0
- package/dist/enrollment/types/enrollment.types.d.ts +25 -0
- package/dist/enrollment/types/enrollment.types.js +1 -0
- package/dist/events/canonical-event.d.ts +10 -0
- package/dist/events/canonical-event.js +9 -0
- package/dist/events/constants/enrich.constants.d.ts +14 -0
- package/dist/events/constants/enrich.constants.js +15 -0
- package/dist/events/constants/events.constants.d.ts +35 -0
- package/dist/events/constants/events.constants.js +57 -0
- package/dist/events/enrich.d.ts +16 -0
- package/dist/events/enrich.js +226 -0
- package/dist/events/event-id.d.ts +32 -0
- package/dist/events/event-id.js +49 -0
- package/dist/events/index.d.ts +14 -0
- package/dist/events/index.js +5 -0
- package/dist/events/llm-call.d.ts +14 -0
- package/dist/events/llm-call.js +84 -0
- package/dist/events/product-event.d.ts +39 -0
- package/dist/events/product-event.js +19 -0
- package/dist/events/types/enrich.types.d.ts +25 -0
- package/dist/events/types/enrich.types.js +1 -0
- package/dist/events/types/events.types.d.ts +112 -0
- package/dist/events/types/events.types.js +1 -0
- package/dist/events/types/llm-call.types.d.ts +79 -0
- package/dist/events/types/llm-call.types.js +1 -0
- package/dist/events/types/repo-snapshot.types.d.ts +32 -0
- package/dist/events/types/repo-snapshot.types.js +1 -0
- package/dist/feature/constants/feature.constants.d.ts +10 -0
- package/dist/feature/constants/feature.constants.js +10 -0
- package/dist/feature/index.d.ts +6 -0
- package/dist/feature/index.js +6 -0
- package/dist/feature/ticket-candidates.d.ts +13 -0
- package/dist/feature/ticket-candidates.js +26 -0
- package/dist/git/constants/git.constants.d.ts +84 -0
- package/dist/git/constants/git.constants.js +113 -0
- package/dist/git/git-context.d.ts +52 -0
- package/dist/git/git-context.js +226 -0
- package/dist/git/index.d.ts +9 -0
- package/dist/git/index.js +3 -0
- package/dist/git/remote-sanitize.d.ts +26 -0
- package/dist/git/remote-sanitize.js +92 -0
- package/dist/git/repo-snapshot.d.ts +40 -0
- package/dist/git/repo-snapshot.js +95 -0
- package/dist/git/types/git.types.d.ts +36 -0
- package/dist/git/types/git.types.js +1 -0
- package/dist/git/types/snapshot.types.d.ts +25 -0
- package/dist/git/types/snapshot.types.js +1 -0
- package/dist/otlp/constants/otlp.constants.d.ts +84 -0
- package/dist/otlp/constants/otlp.constants.js +99 -0
- package/dist/otlp/http.d.ts +24 -0
- package/dist/otlp/http.js +37 -0
- package/dist/otlp/index.d.ts +9 -0
- package/dist/otlp/index.js +3 -0
- package/dist/otlp/normalize.d.ts +14 -0
- package/dist/otlp/normalize.js +404 -0
- package/dist/otlp/types/otlp.types.d.ts +69 -0
- package/dist/otlp/types/otlp.types.js +1 -0
- package/dist/pipeline/constants/pipeline.constants.d.ts +23 -0
- package/dist/pipeline/constants/pipeline.constants.js +22 -0
- package/dist/pipeline/hook-pipeline.d.ts +14 -0
- package/dist/pipeline/hook-pipeline.js +297 -0
- package/dist/pipeline/index.d.ts +6 -0
- package/dist/pipeline/index.js +1 -0
- package/dist/pipeline/types/pipeline.types.d.ts +48 -0
- package/dist/pipeline/types/pipeline.types.js +1 -0
- package/dist/privacy/constants/privacy.constants.d.ts +23 -0
- package/dist/privacy/constants/privacy.constants.js +38 -0
- package/dist/privacy/index.d.ts +7 -0
- package/dist/privacy/index.js +2 -0
- package/dist/privacy/sanitizer.d.ts +20 -0
- package/dist/privacy/sanitizer.js +52 -0
- package/dist/privacy/types/privacy.types.d.ts +13 -0
- package/dist/privacy/types/privacy.types.js +1 -0
- package/dist/providers/antigravity/antigravity.adapter.d.ts +54 -0
- package/dist/providers/antigravity/antigravity.adapter.js +311 -0
- package/dist/providers/antigravity/antigravity.detect.d.ts +25 -0
- package/dist/providers/antigravity/antigravity.detect.js +64 -0
- package/dist/providers/antigravity/antigravity.hooks.d.ts +24 -0
- package/dist/providers/antigravity/antigravity.hooks.js +126 -0
- package/dist/providers/antigravity/antigravity.provider.d.ts +2 -0
- package/dist/providers/antigravity/antigravity.provider.js +22 -0
- package/dist/providers/antigravity/constants/antigravity.constants.d.ts +72 -0
- package/dist/providers/antigravity/constants/antigravity.constants.js +75 -0
- package/dist/providers/antigravity/schemas/antigravity.schema.d.ts +521 -0
- package/dist/providers/antigravity/schemas/antigravity.schema.js +64 -0
- package/dist/providers/antigravity/types/antigravity.types.d.ts +13 -0
- package/dist/providers/antigravity/types/antigravity.types.js +1 -0
- package/dist/providers/claude/claude.adapter.d.ts +15 -0
- package/dist/providers/claude/claude.adapter.js +141 -0
- package/dist/providers/claude/claude.detect.d.ts +20 -0
- package/dist/providers/claude/claude.detect.js +57 -0
- package/dist/providers/claude/claude.hooks.d.ts +23 -0
- package/dist/providers/claude/claude.hooks.js +94 -0
- package/dist/providers/claude/claude.otel.d.ts +95 -0
- package/dist/providers/claude/claude.otel.js +331 -0
- package/dist/providers/claude/claude.provider.d.ts +2 -0
- package/dist/providers/claude/claude.provider.js +26 -0
- package/dist/providers/claude/constants/claude.constants.d.ts +34 -0
- package/dist/providers/claude/constants/claude.constants.js +54 -0
- package/dist/providers/claude/constants/claude.otel.constants.d.ts +17 -0
- package/dist/providers/claude/constants/claude.otel.constants.js +17 -0
- package/dist/providers/claude/schemas/claude.schema.d.ts +72 -0
- package/dist/providers/claude/schemas/claude.schema.js +32 -0
- package/dist/providers/claude/types/claude.types.d.ts +3 -0
- package/dist/providers/claude/types/claude.types.js +1 -0
- package/dist/providers/codex/codex.adapter.d.ts +11 -0
- package/dist/providers/codex/codex.adapter.js +106 -0
- package/dist/providers/codex/codex.detect.d.ts +30 -0
- package/dist/providers/codex/codex.detect.js +58 -0
- package/dist/providers/codex/codex.hooks.d.ts +27 -0
- package/dist/providers/codex/codex.hooks.js +129 -0
- package/dist/providers/codex/codex.otel.d.ts +51 -0
- package/dist/providers/codex/codex.otel.js +325 -0
- package/dist/providers/codex/codex.provider.d.ts +2 -0
- package/dist/providers/codex/codex.provider.js +25 -0
- package/dist/providers/codex/constants/codex.constants.d.ts +41 -0
- package/dist/providers/codex/constants/codex.constants.js +62 -0
- package/dist/providers/codex/constants/codex.otel.constants.d.ts +22 -0
- package/dist/providers/codex/constants/codex.otel.constants.js +22 -0
- package/dist/providers/codex/schemas/codex.schema.d.ts +70 -0
- package/dist/providers/codex/schemas/codex.schema.js +32 -0
- package/dist/providers/codex/types/codex.types.d.ts +3 -0
- package/dist/providers/codex/types/codex.types.js +1 -0
- package/dist/providers/constants/provider.constants.d.ts +33 -0
- package/dist/providers/constants/provider.constants.js +33 -0
- package/dist/providers/cursor/constants/cursor.constants.d.ts +58 -0
- package/dist/providers/cursor/constants/cursor.constants.js +95 -0
- package/dist/providers/cursor/cursor.adapter.d.ts +11 -0
- package/dist/providers/cursor/cursor.adapter.js +331 -0
- package/dist/providers/cursor/cursor.detect.d.ts +23 -0
- package/dist/providers/cursor/cursor.detect.js +66 -0
- package/dist/providers/cursor/cursor.hooks.d.ts +25 -0
- package/dist/providers/cursor/cursor.hooks.js +95 -0
- package/dist/providers/cursor/cursor.provider.d.ts +2 -0
- package/dist/providers/cursor/cursor.provider.js +27 -0
- package/dist/providers/cursor/schemas/cursor.schema.d.ts +130 -0
- package/dist/providers/cursor/schemas/cursor.schema.js +62 -0
- package/dist/providers/cursor/types/cursor.types.d.ts +3 -0
- package/dist/providers/cursor/types/cursor.types.js +1 -0
- package/dist/providers/gemini/constants/gemini.constants.d.ts +36 -0
- package/dist/providers/gemini/constants/gemini.constants.js +58 -0
- package/dist/providers/gemini/constants/gemini.otel.constants.d.ts +34 -0
- package/dist/providers/gemini/constants/gemini.otel.constants.js +48 -0
- package/dist/providers/gemini/gemini.adapter.d.ts +15 -0
- package/dist/providers/gemini/gemini.adapter.js +146 -0
- package/dist/providers/gemini/gemini.detect.d.ts +23 -0
- package/dist/providers/gemini/gemini.detect.js +78 -0
- package/dist/providers/gemini/gemini.hooks.d.ts +22 -0
- package/dist/providers/gemini/gemini.hooks.js +93 -0
- package/dist/providers/gemini/gemini.otel.d.ts +62 -0
- package/dist/providers/gemini/gemini.otel.js +274 -0
- package/dist/providers/gemini/gemini.provider.d.ts +2 -0
- package/dist/providers/gemini/gemini.provider.js +22 -0
- package/dist/providers/gemini/schemas/gemini.schema.d.ts +81 -0
- package/dist/providers/gemini/schemas/gemini.schema.js +35 -0
- package/dist/providers/gemini/types/gemini.types.d.ts +3 -0
- package/dist/providers/gemini/types/gemini.types.js +1 -0
- package/dist/providers/index.d.ts +14 -0
- package/dist/providers/index.js +8 -0
- package/dist/providers/provider.d.ts +16 -0
- package/dist/providers/provider.js +149 -0
- package/dist/providers/registry.d.ts +12 -0
- package/dist/providers/registry.js +23 -0
- package/dist/providers/shared/constants/hook-refusal.constants.d.ts +6 -0
- package/dist/providers/shared/constants/hook-refusal.constants.js +6 -0
- package/dist/providers/shared/constants/tooling.constants.d.ts +25 -0
- package/dist/providers/shared/constants/tooling.constants.js +25 -0
- package/dist/providers/shared/event-builder.d.ts +85 -0
- package/dist/providers/shared/event-builder.js +166 -0
- package/dist/providers/shared/hook-config.d.ts +80 -0
- package/dist/providers/shared/hook-config.js +164 -0
- package/dist/providers/shared/hook-refusal.d.ts +16 -0
- package/dist/providers/shared/hook-refusal.js +33 -0
- package/dist/providers/shared/install-record.d.ts +75 -0
- package/dist/providers/shared/install-record.js +113 -0
- package/dist/providers/shared/tooling.d.ts +58 -0
- package/dist/providers/shared/tooling.js +103 -0
- package/dist/providers/shared/types/adapter.types.d.ts +54 -0
- package/dist/providers/shared/types/adapter.types.js +1 -0
- package/dist/providers/shared/types/hook-config.types.d.ts +32 -0
- package/dist/providers/shared/types/hook-config.types.js +1 -0
- package/dist/providers/types/provider.types.d.ts +98 -0
- package/dist/providers/types/provider.types.js +1 -0
- package/dist/snapshot/branch-selection.d.ts +37 -0
- package/dist/snapshot/branch-selection.js +69 -0
- package/dist/snapshot/budget.d.ts +41 -0
- package/dist/snapshot/budget.js +67 -0
- package/dist/snapshot/constants/snapshot-stages.constants.d.ts +11 -0
- package/dist/snapshot/constants/snapshot-stages.constants.js +11 -0
- package/dist/snapshot/constants/snapshot.constants.d.ts +56 -0
- package/dist/snapshot/constants/snapshot.constants.js +56 -0
- package/dist/snapshot/index.d.ts +16 -0
- package/dist/snapshot/index.js +6 -0
- package/dist/snapshot/snapshot-event.d.ts +17 -0
- package/dist/snapshot/snapshot-event.js +66 -0
- package/dist/snapshot/snapshot-pipeline.d.ts +14 -0
- package/dist/snapshot/snapshot-pipeline.js +163 -0
- package/dist/snapshot/snapshot-state.d.ts +55 -0
- package/dist/snapshot/snapshot-state.js +100 -0
- package/dist/snapshot/types/snapshot.types.d.ts +86 -0
- package/dist/snapshot/types/snapshot.types.js +1 -0
- package/dist/storage/atomic-file.d.ts +25 -0
- package/dist/storage/atomic-file.js +76 -0
- package/dist/storage/constants/storage.constants.d.ts +34 -0
- package/dist/storage/constants/storage.constants.js +35 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.js +5 -0
- package/dist/storage/install-state.d.ts +20 -0
- package/dist/storage/install-state.js +40 -0
- package/dist/storage/json-file.d.ts +13 -0
- package/dist/storage/json-file.js +31 -0
- package/dist/storage/lock.d.ts +15 -0
- package/dist/storage/lock.js +70 -0
- package/dist/storage/paths.d.ts +14 -0
- package/dist/storage/paths.js +42 -0
- package/dist/storage/schemas/storage.schema.d.ts +128 -0
- package/dist/storage/schemas/storage.schema.js +27 -0
- package/dist/storage/types/storage.types.d.ts +36 -0
- package/dist/storage/types/storage.types.js +1 -0
- package/dist/transport/constants/transport.constants.d.ts +47 -0
- package/dist/transport/constants/transport.constants.js +47 -0
- package/dist/transport/cooldown.d.ts +35 -0
- package/dist/transport/cooldown.js +62 -0
- package/dist/transport/delivery-stats.d.ts +65 -0
- package/dist/transport/delivery-stats.js +186 -0
- package/dist/transport/delivery.d.ts +26 -0
- package/dist/transport/delivery.js +80 -0
- package/dist/transport/headers.d.ts +12 -0
- package/dist/transport/headers.js +19 -0
- package/dist/transport/http-transport.d.ts +39 -0
- package/dist/transport/http-transport.js +106 -0
- package/dist/transport/index.d.ts +13 -0
- package/dist/transport/index.js +7 -0
- package/dist/transport/queue.d.ts +177 -0
- package/dist/transport/queue.js +474 -0
- package/dist/transport/schemas/queue.schema.d.ts +30 -0
- package/dist/transport/schemas/queue.schema.js +18 -0
- package/dist/transport/transport.d.ts +6 -0
- package/dist/transport/transport.js +1 -0
- package/dist/transport/types/transport.types.d.ts +102 -0
- package/dist/transport/types/transport.types.js +1 -0
- package/dist/turns/aggregate-usage.d.ts +20 -0
- package/dist/turns/aggregate-usage.js +269 -0
- package/dist/turns/claude-transcript.d.ts +18 -0
- package/dist/turns/claude-transcript.js +80 -0
- package/dist/turns/constants/turns.constants.d.ts +69 -0
- package/dist/turns/constants/turns.constants.js +86 -0
- package/dist/turns/cursor-transcript.d.ts +21 -0
- package/dist/turns/cursor-transcript.js +66 -0
- package/dist/turns/index.d.ts +17 -0
- package/dist/turns/index.js +7 -0
- package/dist/turns/transcript.d.ts +74 -0
- package/dist/turns/transcript.js +188 -0
- package/dist/turns/turn-state.d.ts +94 -0
- package/dist/turns/turn-state.js +234 -0
- package/dist/turns/turn-summary.d.ts +27 -0
- package/dist/turns/turn-summary.js +164 -0
- package/dist/turns/turn-tracker.d.ts +14 -0
- package/dist/turns/turn-tracker.js +521 -0
- package/dist/turns/types/aggregate-usage.types.d.ts +26 -0
- package/dist/turns/types/aggregate-usage.types.js +1 -0
- package/dist/turns/types/transcript.types.d.ts +41 -0
- package/dist/turns/types/transcript.types.js +1 -0
- package/dist/turns/types/turn-state.types.d.ts +37 -0
- package/dist/turns/types/turn-state.types.js +1 -0
- package/dist/turns/types/turn-summary.types.d.ts +106 -0
- package/dist/turns/types/turn-summary.types.js +1 -0
- package/dist/turns/types/turn-tracker.types.d.ts +27 -0
- package/dist/turns/types/turn-tracker.types.js +1 -0
- package/example/README.md +43 -0
- package/example/server.mjs +240 -0
- package/package.json +89 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
/** Local auth state each agent records its billing arrangement in. */
|
|
3
|
+
export const CLAUDE_STATE_FILE = '.claude.json';
|
|
4
|
+
export const CODEX_AUTH_FILE = path.join('.codex', 'auth.json');
|
|
5
|
+
export const GEMINI_SETTINGS_FILE = path.join('.gemini', 'settings.json');
|
|
6
|
+
export const GEMINI_OAUTH_FILE = path.join('.gemini', 'oauth.json');
|
|
7
|
+
/** Environment variables that put an agent on per-token API billing. */
|
|
8
|
+
export const CLAUDE_BEDROCK_VAR = 'CLAUDE_CODE_USE_BEDROCK';
|
|
9
|
+
export const CLAUDE_VERTEX_VAR = 'CLAUDE_CODE_USE_VERTEX';
|
|
10
|
+
export const ANTHROPIC_API_KEY_VAR = 'ANTHROPIC_API_KEY';
|
|
11
|
+
export const GEMINI_API_KEY_VARS = ['GEMINI_API_KEY', 'GOOGLE_API_KEY', 'GOOGLE_GENAI_USE_VERTEXAI'];
|
|
12
|
+
/** Fields the agents' own auth state uses. */
|
|
13
|
+
export const CLAUDE_OAUTH_FIELD = 'oauthAccount';
|
|
14
|
+
export const CLAUDE_BILLING_TYPE_FIELD = 'billingType';
|
|
15
|
+
export const CLAUDE_API_KEY_RESPONSES_FIELD = 'customApiKeyResponses';
|
|
16
|
+
export const CLAUDE_APPROVED_FIELD = 'approved';
|
|
17
|
+
export const CODEX_AUTH_MODE_FIELD = 'auth_mode';
|
|
18
|
+
export const CODEX_API_KEY_FIELD = 'OPENAI_API_KEY';
|
|
19
|
+
export const GEMINI_MODE_FIELDS = ['auth_mode', 'billingType'];
|
|
20
|
+
export const GEMINI_API_KEY_FIELDS = ['GEMINI_API_KEY', 'GOOGLE_API_KEY'];
|
|
21
|
+
/** Auth-mode values Codex reports. */
|
|
22
|
+
export const CODEX_SUBSCRIPTION_MODE = 'chatgpt';
|
|
23
|
+
export const CODEX_API_MODE = 'apikey';
|
|
24
|
+
/** Substrings that positively identify a billing arrangement. */
|
|
25
|
+
export const SUBSCRIPTION_MARKER = 'subscription';
|
|
26
|
+
export const API_MARKER = 'api';
|
|
27
|
+
/**
|
|
28
|
+
* Shortest approval entry we will match a key against.
|
|
29
|
+
*
|
|
30
|
+
* Claude Code records an approved environment key as a hash prefix or a key
|
|
31
|
+
* tail; anything shorter than this would match far too many keys to mean
|
|
32
|
+
* anything.
|
|
33
|
+
*/
|
|
34
|
+
export const MIN_APPROVAL_ENTRY_LENGTH = 8;
|
|
35
|
+
/** Environment values that mean "not set", beyond an absent variable. */
|
|
36
|
+
export const FALSY_ENV_VALUES = new Set(['', '0', 'false']);
|
|
37
|
+
/** Agent ids that authenticate through the shared ~/.gemini Google account. */
|
|
38
|
+
export const GOOGLE_ACCOUNT_AGENTS = new Set(['gemini', 'antigravity']);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the developer pays for each agent, detected from its own local auth
|
|
3
|
+
* state. A turn priced under the wrong arrangement is worse than one that
|
|
4
|
+
* admits it does not know, so only positively recognized states are reported.
|
|
5
|
+
*/
|
|
6
|
+
export { detectBillingMode } from './billing-mode.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the developer pays for each agent, detected from its own local auth
|
|
3
|
+
* state. A turn priced under the wrong arrangement is worse than one that
|
|
4
|
+
* admits it does not know, so only positively recognized states are reported.
|
|
5
|
+
*/
|
|
6
|
+
export { detectBillingMode } from './billing-mode.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ParsedArgs } from './types/cli.types.js';
|
|
2
|
+
export type { ParsedArgs } from './types/cli.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parse argv.
|
|
5
|
+
*
|
|
6
|
+
* Hand-rolled on purpose: the `hook` subcommand runs on the coding agent's
|
|
7
|
+
* critical path, and importing a CLI framework would cost every hook
|
|
8
|
+
* invocation the framework's startup.
|
|
9
|
+
*
|
|
10
|
+
* @param argv - Arguments after the executable and script.
|
|
11
|
+
* @returns The command, positionals and flags.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseArgs(argv: readonly string[]): ParsedArgs;
|
|
14
|
+
/**
|
|
15
|
+
* A flag's value when it was given as a string.
|
|
16
|
+
*
|
|
17
|
+
* @param parsed - Parsed arguments.
|
|
18
|
+
* @param name - Flag name without the `--`.
|
|
19
|
+
* @returns The value, or undefined when absent or boolean.
|
|
20
|
+
*/
|
|
21
|
+
export declare function stringFlag(parsed: ParsedArgs, name: string): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Whether a boolean flag was given.
|
|
24
|
+
*
|
|
25
|
+
* @param parsed - Parsed arguments.
|
|
26
|
+
* @param name - Flag name without the `--`.
|
|
27
|
+
* @returns True when present.
|
|
28
|
+
*/
|
|
29
|
+
export declare function boolFlag(parsed: ParsedArgs, name: string): boolean;
|
package/dist/cli/args.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { FLAG_PREFIX, VALUE_FLAGS } from './constants/cli.constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse argv.
|
|
4
|
+
*
|
|
5
|
+
* Hand-rolled on purpose: the `hook` subcommand runs on the coding agent's
|
|
6
|
+
* critical path, and importing a CLI framework would cost every hook
|
|
7
|
+
* invocation the framework's startup.
|
|
8
|
+
*
|
|
9
|
+
* @param argv - Arguments after the executable and script.
|
|
10
|
+
* @returns The command, positionals and flags.
|
|
11
|
+
*/
|
|
12
|
+
export function parseArgs(argv) {
|
|
13
|
+
const positional = [];
|
|
14
|
+
const flags = {};
|
|
15
|
+
let command;
|
|
16
|
+
let index = 0;
|
|
17
|
+
while (index < argv.length) {
|
|
18
|
+
const arg = argv[index];
|
|
19
|
+
if (!arg.startsWith(FLAG_PREFIX)) {
|
|
20
|
+
if (command === undefined) {
|
|
21
|
+
command = arg;
|
|
22
|
+
index += 1;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
positional.push(arg);
|
|
26
|
+
index += 1;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const name = arg.slice(FLAG_PREFIX.length);
|
|
30
|
+
const value = argv[index + 1];
|
|
31
|
+
if (VALUE_FLAGS.has(name) && value !== undefined && !value.startsWith(FLAG_PREFIX)) {
|
|
32
|
+
flags[name] = value;
|
|
33
|
+
index += 2;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
flags[name] = true;
|
|
37
|
+
index += 1;
|
|
38
|
+
}
|
|
39
|
+
return { command, positional, flags };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A flag's value when it was given as a string.
|
|
43
|
+
*
|
|
44
|
+
* @param parsed - Parsed arguments.
|
|
45
|
+
* @param name - Flag name without the `--`.
|
|
46
|
+
* @returns The value, or undefined when absent or boolean.
|
|
47
|
+
*/
|
|
48
|
+
export function stringFlag(parsed, name) {
|
|
49
|
+
const value = parsed.flags[name];
|
|
50
|
+
return typeof value === 'string' ? value : undefined;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Whether a boolean flag was given.
|
|
54
|
+
*
|
|
55
|
+
* @param parsed - Parsed arguments.
|
|
56
|
+
* @param name - Flag name without the `--`.
|
|
57
|
+
* @returns True when present.
|
|
58
|
+
*/
|
|
59
|
+
export function boolFlag(parsed, name) {
|
|
60
|
+
return parsed.flags[name] === true;
|
|
61
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flags documented as taking a value.
|
|
3
|
+
*
|
|
4
|
+
* A flag missing from this set silently turns its value into a positional and
|
|
5
|
+
* itself into a boolean — which is how `--otel none` once ignored the selection
|
|
6
|
+
* entirely.
|
|
7
|
+
*/
|
|
8
|
+
export declare const VALUE_FLAGS: ReadonlySet<string>;
|
|
9
|
+
export declare const FLAG_PREFIX = "--";
|
|
10
|
+
/** Commands the CLI dispatches. */
|
|
11
|
+
export declare const COMMANDS: readonly ["hook", "setup", "status", "doctor", "uninstall", "agents", "config", "otel-headers"];
|
|
12
|
+
/** What setup asks for when nothing on the machine names the developer. */
|
|
13
|
+
export declare const DEVELOPER_EMAIL_PROMPT = "Developer email: ";
|
|
14
|
+
/** Doctor's name for the identity every per-developer decision is keyed on. */
|
|
15
|
+
export declare const DEVELOPER_IDENTITY_CHECK = "developer identity";
|
|
16
|
+
/**
|
|
17
|
+
* The unattributable install, and the two ways out of it.
|
|
18
|
+
*
|
|
19
|
+
* Named together everywhere the condition surfaces: the machine hitting this is
|
|
20
|
+
* the one whose owner is not watching the terminal, so the message has to carry
|
|
21
|
+
* the whole fix rather than a hint to go looking for it.
|
|
22
|
+
*/
|
|
23
|
+
export declare const NO_DEVELOPER_IDENTITY = "no developer identity: `git config user.email` is unset here and --developer-email was not given";
|
|
24
|
+
export declare const DEVELOPER_IDENTITY_REMEDIES = "set one with `git config --global user.email you@company.com`, or re-run setup with `--developer-email you@company.com`";
|
|
25
|
+
/** Said on the failure path, because a half-written config is worse than none. */
|
|
26
|
+
export declare const NO_CONFIG_WRITTEN = "no configuration was written; re-run setup once the identity resolves";
|
|
27
|
+
/** Ceiling on a hook payload; beyond this the hook refuses rather than buffers. */
|
|
28
|
+
export declare const MAX_STDIN_BYTES: number;
|
|
29
|
+
/** How long the hook waits for stdin before proceeding with what it has. */
|
|
30
|
+
export declare const STDIN_TIMEOUT_MS = 5000;
|
|
31
|
+
/** Node major version the runtime requires. */
|
|
32
|
+
export declare const MIN_NODE_MAJOR = 20;
|
|
33
|
+
/**
|
|
34
|
+
* prompt_id (== OTel prompt.id) appeared in this Claude Code release; older
|
|
35
|
+
* versions fall back to session-scoped turn tracking with an empty turn_id.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CLAUDE_MIN_VERSION_FOR_PROMPT_ID = "2.1.196";
|
|
38
|
+
/** Budgets for the diagnostics that shell out or reach the network. */
|
|
39
|
+
export declare const BACKEND_PROBE_TIMEOUT_MS = 4000;
|
|
40
|
+
export declare const CLAUDE_VERSION_TIMEOUT_MS = 5000;
|
|
41
|
+
export declare const GIT_VERSION_TIMEOUT_MS = 2000;
|
|
42
|
+
/** Longer than the hook path's budget: status is not on anyone's critical path. */
|
|
43
|
+
export declare const STATUS_SEND_TIMEOUT_MS = 3000;
|
|
44
|
+
/** Backlog age past which `doctor` starts warning. */
|
|
45
|
+
export declare const STALE_QUEUE_AGE_MS: number;
|
|
46
|
+
/** ANSI escape and colour codes for the human-facing commands. */
|
|
47
|
+
export declare const ESC = "\u001B";
|
|
48
|
+
export declare const COLOR_GREEN = "32";
|
|
49
|
+
export declare const COLOR_YELLOW = "33";
|
|
50
|
+
export declare const COLOR_RED = "31";
|
|
51
|
+
export declare const COLOR_GREY = "90";
|
|
52
|
+
export declare const COLOR_BOLD = "1";
|
|
53
|
+
export declare const COLOR_RESET = "0";
|
|
54
|
+
/** Set by convention to disable colour output. */
|
|
55
|
+
export declare const NO_COLOR_VAR = "NO_COLOR";
|
|
56
|
+
/** Argument shapes that force quoting when a hook command is generated. */
|
|
57
|
+
export declare const RE_NEEDS_QUOTING: RegExp;
|
|
58
|
+
export declare const RE_QUOTE_ESCAPE: RegExp;
|
|
59
|
+
/** Redaction placeholder in the `config` command's output. */
|
|
60
|
+
export declare const REDACTED_TOKEN = "<redacted>";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flags documented as taking a value.
|
|
3
|
+
*
|
|
4
|
+
* A flag missing from this set silently turns its value into a positional and
|
|
5
|
+
* itself into a boolean — which is how `--otel none` once ignored the selection
|
|
6
|
+
* entirely.
|
|
7
|
+
*/
|
|
8
|
+
export const VALUE_FLAGS = new Set(['agent', 'endpoint', 'token', 'developer-email', 'otel']);
|
|
9
|
+
export const FLAG_PREFIX = '--';
|
|
10
|
+
/** Commands the CLI dispatches. */
|
|
11
|
+
export const COMMANDS = ['hook', 'setup', 'status', 'doctor', 'uninstall', 'agents', 'config', 'otel-headers'];
|
|
12
|
+
/** What setup asks for when nothing on the machine names the developer. */
|
|
13
|
+
export const DEVELOPER_EMAIL_PROMPT = 'Developer email: ';
|
|
14
|
+
/** Doctor's name for the identity every per-developer decision is keyed on. */
|
|
15
|
+
export const DEVELOPER_IDENTITY_CHECK = 'developer identity';
|
|
16
|
+
/**
|
|
17
|
+
* The unattributable install, and the two ways out of it.
|
|
18
|
+
*
|
|
19
|
+
* Named together everywhere the condition surfaces: the machine hitting this is
|
|
20
|
+
* the one whose owner is not watching the terminal, so the message has to carry
|
|
21
|
+
* the whole fix rather than a hint to go looking for it.
|
|
22
|
+
*/
|
|
23
|
+
export const NO_DEVELOPER_IDENTITY = 'no developer identity: `git config user.email` is unset here and --developer-email was not given';
|
|
24
|
+
export const DEVELOPER_IDENTITY_REMEDIES = 'set one with `git config --global user.email you@company.com`, or re-run setup with `--developer-email you@company.com`';
|
|
25
|
+
/** Said on the failure path, because a half-written config is worse than none. */
|
|
26
|
+
export const NO_CONFIG_WRITTEN = 'no configuration was written; re-run setup once the identity resolves';
|
|
27
|
+
/** Ceiling on a hook payload; beyond this the hook refuses rather than buffers. */
|
|
28
|
+
export const MAX_STDIN_BYTES = 10 * 1024 * 1024;
|
|
29
|
+
/** How long the hook waits for stdin before proceeding with what it has. */
|
|
30
|
+
export const STDIN_TIMEOUT_MS = 5_000;
|
|
31
|
+
/** Node major version the runtime requires. */
|
|
32
|
+
export const MIN_NODE_MAJOR = 20;
|
|
33
|
+
/**
|
|
34
|
+
* prompt_id (== OTel prompt.id) appeared in this Claude Code release; older
|
|
35
|
+
* versions fall back to session-scoped turn tracking with an empty turn_id.
|
|
36
|
+
*/
|
|
37
|
+
export const CLAUDE_MIN_VERSION_FOR_PROMPT_ID = '2.1.196';
|
|
38
|
+
/** Budgets for the diagnostics that shell out or reach the network. */
|
|
39
|
+
export const BACKEND_PROBE_TIMEOUT_MS = 4_000;
|
|
40
|
+
export const CLAUDE_VERSION_TIMEOUT_MS = 5_000;
|
|
41
|
+
export const GIT_VERSION_TIMEOUT_MS = 2_000;
|
|
42
|
+
/** Longer than the hook path's budget: status is not on anyone's critical path. */
|
|
43
|
+
export const STATUS_SEND_TIMEOUT_MS = 3_000;
|
|
44
|
+
/** Backlog age past which `doctor` starts warning. */
|
|
45
|
+
export const STALE_QUEUE_AGE_MS = 24 * 60 * 60 * 1000;
|
|
46
|
+
/** ANSI escape and colour codes for the human-facing commands. */
|
|
47
|
+
export const ESC = '\u001b';
|
|
48
|
+
export const COLOR_GREEN = '32';
|
|
49
|
+
export const COLOR_YELLOW = '33';
|
|
50
|
+
export const COLOR_RED = '31';
|
|
51
|
+
export const COLOR_GREY = '90';
|
|
52
|
+
export const COLOR_BOLD = '1';
|
|
53
|
+
export const COLOR_RESET = '0';
|
|
54
|
+
/** Set by convention to disable colour output. */
|
|
55
|
+
export const NO_COLOR_VAR = 'NO_COLOR';
|
|
56
|
+
/** Argument shapes that force quoting when a hook command is generated. */
|
|
57
|
+
export const RE_NEEDS_QUOTING = /[\s"'\\$`]/;
|
|
58
|
+
export const RE_QUOTE_ESCAPE = /(["\\$`])/g;
|
|
59
|
+
/** Redaction placeholder in the `config` command's output. */
|
|
60
|
+
export const REDACTED_TOKEN = '<redacted>';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Env } from '../core/types/core.types.js';
|
|
2
|
+
import { DeliveryStats } from '../transport/delivery-stats.js';
|
|
3
|
+
import { EventQueue } from '../transport/queue.js';
|
|
4
|
+
import type { EventTransport } from '../transport/types/transport.types.js';
|
|
5
|
+
import type { CliContext } from './types/cli.types.js';
|
|
6
|
+
export type { CliContext } from './types/cli.types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Resolve everything a command needs from the environment.
|
|
9
|
+
*
|
|
10
|
+
* One read of the config and install state per command: the individual
|
|
11
|
+
* commands then work from this value instead of each reaching for the disk.
|
|
12
|
+
*
|
|
13
|
+
* @param env - Ambient environment.
|
|
14
|
+
* @returns The context.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildCliContext(env: Env): Promise<CliContext>;
|
|
17
|
+
/**
|
|
18
|
+
* The offline queue for this context.
|
|
19
|
+
*
|
|
20
|
+
* @param context - Resolved CLI context.
|
|
21
|
+
* @returns The queue.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildQueue(context: CliContext): EventQueue;
|
|
24
|
+
/**
|
|
25
|
+
* The delivery-loss tally for this context.
|
|
26
|
+
*
|
|
27
|
+
* @param context - Resolved CLI context.
|
|
28
|
+
* @returns The tally.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildDeliveryStats(context: CliContext): DeliveryStats;
|
|
31
|
+
/**
|
|
32
|
+
* The transport for this context, when a backend is configured.
|
|
33
|
+
*
|
|
34
|
+
* @param context - Resolved CLI context.
|
|
35
|
+
* @param timeoutMs - Override for the configured send timeout.
|
|
36
|
+
* @returns The transport, or undefined before setup has run.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildTransport(context: CliContext, timeoutMs?: number): EventTransport | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The command agents should invoke for hook callbacks.
|
|
41
|
+
*
|
|
42
|
+
* Prefers the installed bin, and falls back to `node <this script>` for a local
|
|
43
|
+
* or linked install. The exact shape matters: `isAgentWatchHookCommand` has to
|
|
44
|
+
* recognize whatever is written here later, or uninstall will not clean it up.
|
|
45
|
+
*
|
|
46
|
+
* @param env - Ambient environment, for the PATH lookup.
|
|
47
|
+
* @param providerId - Agent the hook is for.
|
|
48
|
+
* @param scriptPath - This script's path; defaults to argv[1].
|
|
49
|
+
* @returns The command line.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildHookCommand(env: Env, providerId: string, scriptPath?: string | undefined): string;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { eventsUrl } from '../config/config.js';
|
|
4
|
+
import { loadConfig } from '../config/config-store.js';
|
|
5
|
+
import { findExecutable } from '../core/which.js';
|
|
6
|
+
import { loadInstallState } from '../storage/install-state.js';
|
|
7
|
+
import { resolvePaths } from '../storage/paths.js';
|
|
8
|
+
import { DeliveryStats } from '../transport/delivery-stats.js';
|
|
9
|
+
import { HttpTransport } from '../transport/http-transport.js';
|
|
10
|
+
import { EventQueue } from '../transport/queue.js';
|
|
11
|
+
import { DELIVERY_STATS_FILE_NAME } from '../transport/constants/transport.constants.js';
|
|
12
|
+
import { RE_NEEDS_QUOTING, RE_QUOTE_ESCAPE } from './constants/cli.constants.js';
|
|
13
|
+
/**
|
|
14
|
+
* Resolve everything a command needs from the environment.
|
|
15
|
+
*
|
|
16
|
+
* One read of the config and install state per command: the individual
|
|
17
|
+
* commands then work from this value instead of each reaching for the disk.
|
|
18
|
+
*
|
|
19
|
+
* @param env - Ambient environment.
|
|
20
|
+
* @returns The context.
|
|
21
|
+
*/
|
|
22
|
+
export async function buildCliContext(env) {
|
|
23
|
+
const paths = resolvePaths(env);
|
|
24
|
+
const configResult = await loadConfig(paths);
|
|
25
|
+
return {
|
|
26
|
+
env,
|
|
27
|
+
paths,
|
|
28
|
+
config: configResult.config,
|
|
29
|
+
configState: configResult.state,
|
|
30
|
+
configError: configResult.state === 'invalid' ? configResult.error : undefined,
|
|
31
|
+
installState: await loadInstallState(paths)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The offline queue for this context.
|
|
36
|
+
*
|
|
37
|
+
* @param context - Resolved CLI context.
|
|
38
|
+
* @returns The queue.
|
|
39
|
+
*/
|
|
40
|
+
export function buildQueue(context) {
|
|
41
|
+
return new EventQueue({
|
|
42
|
+
queueDir: context.paths.queueDir,
|
|
43
|
+
locksDir: context.paths.locksDir,
|
|
44
|
+
maxEvents: context.config.delivery.maxQueueEvents,
|
|
45
|
+
maxAttempts: context.config.delivery.maxAttempts,
|
|
46
|
+
maxEventAgeDays: context.config.delivery.maxEventAgeDays,
|
|
47
|
+
now: context.env.now
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The delivery-loss tally for this context.
|
|
52
|
+
*
|
|
53
|
+
* @param context - Resolved CLI context.
|
|
54
|
+
* @returns The tally.
|
|
55
|
+
*/
|
|
56
|
+
export function buildDeliveryStats(context) {
|
|
57
|
+
return new DeliveryStats(path.join(context.paths.dataDir, DELIVERY_STATS_FILE_NAME), context.env.now, context.paths.locksDir);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The transport for this context, when a backend is configured.
|
|
61
|
+
*
|
|
62
|
+
* @param context - Resolved CLI context.
|
|
63
|
+
* @param timeoutMs - Override for the configured send timeout.
|
|
64
|
+
* @returns The transport, or undefined before setup has run.
|
|
65
|
+
*/
|
|
66
|
+
export function buildTransport(context, timeoutMs) {
|
|
67
|
+
const url = eventsUrl(context.config);
|
|
68
|
+
if (!url)
|
|
69
|
+
return undefined;
|
|
70
|
+
return new HttpTransport({
|
|
71
|
+
eventsUrl: url,
|
|
72
|
+
token: context.config.token,
|
|
73
|
+
installationId: context.config.installationId,
|
|
74
|
+
timeoutMs: timeoutMs ?? context.config.delivery.timeoutMs
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The command agents should invoke for hook callbacks.
|
|
79
|
+
*
|
|
80
|
+
* Prefers the installed bin, and falls back to `node <this script>` for a local
|
|
81
|
+
* or linked install. The exact shape matters: `isAgentWatchHookCommand` has to
|
|
82
|
+
* recognize whatever is written here later, or uninstall will not clean it up.
|
|
83
|
+
*
|
|
84
|
+
* @param env - Ambient environment, for the PATH lookup.
|
|
85
|
+
* @param providerId - Agent the hook is for.
|
|
86
|
+
* @param scriptPath - This script's path; defaults to argv[1].
|
|
87
|
+
* @returns The command line.
|
|
88
|
+
*/
|
|
89
|
+
export function buildHookCommand(env, providerId, scriptPath = process.argv[1]) {
|
|
90
|
+
const bin = findExecutable(env, 'agentwatch');
|
|
91
|
+
if (bin)
|
|
92
|
+
return `${quoteArg(bin)} hook --agent ${providerId}`;
|
|
93
|
+
const script = scriptPath ? path.resolve(scriptPath) : 'agentwatch';
|
|
94
|
+
if (script === 'agentwatch')
|
|
95
|
+
return `agentwatch hook --agent ${providerId}`;
|
|
96
|
+
return `${quoteArg(process.execPath)} ${quoteArg(script)} hook --agent ${providerId}`;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Quote a path for embedding in a shell-executed command.
|
|
100
|
+
*
|
|
101
|
+
* @param value - The path.
|
|
102
|
+
* @returns The value, quoted only when it needs to be.
|
|
103
|
+
*/
|
|
104
|
+
function quoteArg(value) {
|
|
105
|
+
if (!RE_NEEDS_QUOTING.test(value))
|
|
106
|
+
return value;
|
|
107
|
+
return `"${value.replace(RE_QUOTE_ESCAPE, '\\$1')}"`;
|
|
108
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Env } from '../core/types/core.types.js';
|
|
2
|
+
import type { DoctorOptions } from './types/cli.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* `agentwatch doctor` — every reason telemetry might not be arriving, in one
|
|
5
|
+
* pass.
|
|
6
|
+
*
|
|
7
|
+
* Each check is independent and self-contained, which is what makes the output
|
|
8
|
+
* useful: a developer reads down the list and the first non-ok line is the thing
|
|
9
|
+
* to fix.
|
|
10
|
+
*
|
|
11
|
+
* @param env - Ambient environment.
|
|
12
|
+
* @param options - Output options and the git runner override.
|
|
13
|
+
* @returns 1 when any check failed, else 0.
|
|
14
|
+
*/
|
|
15
|
+
export declare function runDoctor(env: Env, options?: DoctorOptions): Promise<number>;
|