@yagni-app/code 1.0.5 → 1.0.7

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 (111) hide show
  1. package/README.md +89 -27
  2. package/dist/claudeCompat.d.ts +59 -0
  3. package/dist/claudeCompat.js +109 -2
  4. package/dist/claudePlugins.d.ts +45 -3
  5. package/dist/claudePlugins.js +129 -19
  6. package/dist/cli.js +28 -4
  7. package/dist/doctor.d.ts +42 -4
  8. package/dist/doctor.js +150 -15
  9. package/dist/extension/condensedTools.d.ts +12 -1
  10. package/dist/extension/condensedTools.js +17 -9
  11. package/dist/extension/index.d.ts +18 -5
  12. package/dist/extension/index.js +319 -72
  13. package/dist/extension/mcp/approval.d.ts +45 -0
  14. package/dist/extension/mcp/approval.js +164 -0
  15. package/dist/extension/mcp/auth.d.ts +124 -0
  16. package/dist/extension/mcp/auth.js +560 -0
  17. package/dist/extension/mcp/authStore.d.ts +61 -0
  18. package/dist/extension/mcp/authStore.js +105 -0
  19. package/dist/extension/mcp/callbackPage.d.ts +31 -0
  20. package/dist/extension/mcp/callbackPage.js +222 -0
  21. package/dist/extension/mcp/cliConfig.d.ts +12 -0
  22. package/dist/extension/mcp/cliConfig.js +12 -0
  23. package/dist/extension/mcp/config.d.ts +153 -0
  24. package/dist/extension/mcp/config.js +381 -0
  25. package/dist/extension/mcp/log.d.ts +28 -0
  26. package/dist/extension/mcp/log.js +82 -0
  27. package/dist/extension/mcp/manager.d.ts +100 -0
  28. package/dist/extension/mcp/manager.js +273 -0
  29. package/dist/extension/mcp/names.d.ts +25 -0
  30. package/dist/extension/mcp/names.js +40 -0
  31. package/dist/extension/mcp/panel.d.ts +33 -0
  32. package/dist/extension/mcp/panel.js +268 -0
  33. package/dist/extension/mcp/prompts.d.ts +23 -0
  34. package/dist/extension/mcp/prompts.js +93 -0
  35. package/dist/extension/mcp/startup.d.ts +55 -0
  36. package/dist/extension/mcp/startup.js +152 -0
  37. package/dist/extension/mcp/tools.d.ts +31 -0
  38. package/dist/extension/mcp/tools.js +117 -0
  39. package/dist/extension/mcp/transports.d.ts +17 -0
  40. package/dist/extension/mcp/transports.js +44 -0
  41. package/dist/extension/permission/gate.d.ts +104 -2
  42. package/dist/extension/permission/gate.js +387 -31
  43. package/dist/extension/permission/guardian.d.ts +24 -5
  44. package/dist/extension/permission/guardian.js +162 -24
  45. package/dist/extension/permissionRules/bashFileArgs.d.ts +39 -0
  46. package/dist/extension/permissionRules/bashFileArgs.js +236 -0
  47. package/dist/extension/permissionRules/engine.d.ts +50 -0
  48. package/dist/extension/permissionRules/engine.js +238 -0
  49. package/dist/extension/permissionRules/loadConfig.d.ts +53 -0
  50. package/dist/extension/permissionRules/loadConfig.js +90 -0
  51. package/dist/extension/permissionRules/parser.d.ts +38 -0
  52. package/dist/extension/permissionRules/parser.js +136 -0
  53. package/dist/extension/permissionRules/pathRules.d.ts +58 -0
  54. package/dist/extension/permissionRules/pathRules.js +120 -0
  55. package/dist/extension/permissionRules/shellRules.d.ts +52 -0
  56. package/dist/extension/permissionRules/shellRules.js +221 -0
  57. package/dist/extension/pipeline/invocation.d.ts +3 -6
  58. package/dist/extension/pipeline/invocation.js +3 -6
  59. package/dist/extension/pipeline/personas.js +5 -0
  60. package/dist/extension/pipeline/runner.d.ts +0 -1
  61. package/dist/extension/pipeline/runner.js +6 -14
  62. package/dist/extension/plugins/inventory.d.ts +88 -0
  63. package/dist/extension/plugins/inventory.js +144 -0
  64. package/dist/extension/plugins/panel.d.ts +45 -0
  65. package/dist/extension/plugins/panel.js +293 -0
  66. package/dist/extension/sandbox/bash.d.ts +99 -0
  67. package/dist/extension/sandbox/bash.js +190 -0
  68. package/dist/extension/sandbox/config.d.ts +114 -0
  69. package/dist/extension/sandbox/config.js +366 -0
  70. package/dist/extension/sandbox/manager.d.ts +98 -0
  71. package/dist/extension/sandbox/manager.js +216 -0
  72. package/dist/extension/sandbox/panel.d.ts +111 -0
  73. package/dist/extension/sandbox/panel.js +342 -0
  74. package/dist/extension/sandbox/session.d.ts +85 -0
  75. package/dist/extension/sandbox/session.js +775 -0
  76. package/dist/extension/telemetry/attrs.d.ts +96 -0
  77. package/dist/extension/telemetry/attrs.js +149 -0
  78. package/dist/extension/telemetry/config.d.ts +99 -0
  79. package/dist/extension/telemetry/config.js +193 -0
  80. package/dist/extension/telemetry/index.d.ts +7 -0
  81. package/dist/extension/telemetry/index.js +7 -0
  82. package/dist/extension/telemetry/probe.d.ts +29 -0
  83. package/dist/extension/telemetry/probe.js +122 -0
  84. package/dist/extension/telemetry/register.d.ts +40 -0
  85. package/dist/extension/telemetry/register.js +192 -0
  86. package/dist/extension/telemetry/sdk.d.ts +63 -0
  87. package/dist/extension/telemetry/sdk.js +207 -0
  88. package/dist/extension/telemetry/tracker.d.ts +131 -0
  89. package/dist/extension/telemetry/tracker.js +551 -0
  90. package/dist/extension/vendor/IGNORE-LICENSE-MIT +21 -0
  91. package/dist/extension/vendor/ignore.d.ts +86 -0
  92. package/dist/extension/vendor/ignore.js +788 -0
  93. package/dist/goHeadless.d.ts +1 -1
  94. package/dist/goHeadless.js +2 -2
  95. package/dist/launch.d.ts +4 -3
  96. package/dist/launch.js +7 -4
  97. package/dist/mcpCommand.d.ts +122 -0
  98. package/dist/mcpCommand.js +787 -0
  99. package/dist/otel.d.ts +69 -63
  100. package/dist/otel.js +154 -119
  101. package/dist/paths.d.ts +13 -0
  102. package/dist/paths.js +18 -0
  103. package/dist/pluginCommand.d.ts +43 -0
  104. package/dist/pluginCommand.js +499 -0
  105. package/dist/pluginStore.d.ts +170 -0
  106. package/dist/pluginStore.js +554 -0
  107. package/dist/upgrade.d.ts +11 -2
  108. package/dist/upgrade.js +48 -8
  109. package/package.json +20 -3
  110. package/dist/extension/mcpTools.d.ts +0 -57
  111. package/dist/extension/mcpTools.js +0 -132
@@ -65,7 +65,7 @@ export declare function buildHeadlessChildEnv(opts: {
65
65
  workspaceId?: string;
66
66
  cliVersion?: string;
67
67
  sessionId?: string;
68
- /** Resolved OTel export config; stage children load pi-otel when present. */
68
+ /** Resolved OTel export config; stage children export when present. */
69
69
  otel?: OtelLaunchConfig;
70
70
  }): NodeJS.ProcessEnv;
71
71
  /**
@@ -55,8 +55,8 @@ export function buildHeadlessChildEnv(opts) {
55
55
  PI_CODING_AGENT_DIR: piAgentDir,
56
56
  PI_SKIP_VERSION_CHECK: "1",
57
57
  PI_TELEMETRY: "0",
58
- // OTel export: pin metadata-only capture and forward pi-otel's path so
59
- // every stage child spawns with it (see otel.ts for the policy).
58
+ // OTel export: the gate plus the OTLP env, inherited by every stage child
59
+ // (see otel.ts for the policy).
60
60
  ...(opts.otel ? otelChildEnv(opts.otel, opts.baseEnv) : {}),
61
61
  };
62
62
  }
package/dist/launch.d.ts CHANGED
@@ -95,9 +95,10 @@ export interface BuildLaunchOptions {
95
95
  extraEnv?: Record<string, string>;
96
96
  /**
97
97
  * Resolved OTel export config (see `otel.ts`). When present, the session
98
- * loads pi-otel alongside our extension and the env pins metadata-only
99
- * capture; absent means no OTLP endpoint is configured and the launch is
100
- * byte-for-byte what it was before OTel support existed.
98
+ * env carries the export gate and the OTLP variables and the bundled
99
+ * extension exports traces, metrics, and log events; absent means no OTLP
100
+ * endpoint is configured and the launch is byte-for-byte what it was
101
+ * before OTel support existed.
101
102
  */
102
103
  otel?: OtelLaunchConfig;
103
104
  }
package/dist/launch.js CHANGED
@@ -9,6 +9,7 @@ import { randomUUID } from "node:crypto";
9
9
  import { agentDirEnvVar } from "./branding.js";
10
10
  import { otelChildEnv } from "./otel.js";
11
11
  import { PAD_X_ENV, resolvePadX } from "./padding.js";
12
+ import { resolveCliPath } from "./paths.js";
12
13
  import { ENGINEERING_PRACTICE_SECTION, promptEnrichmentDisabled } from "./promptEnrichment.js";
13
14
  /**
14
15
  * How close to expiry the token can be before launch warns. A coding session
@@ -76,6 +77,9 @@ export function buildLaunch(creds, passthroughArgs, opts) {
76
77
  // the launcher read (0600). Absent when the caller can't resolve it.
77
78
  ...(opts.profilePath ? { YAGNI_PROFILE_PATH: opts.profilePath } : {}),
78
79
  ...(opts.stateDir ? { YAGNI_CODE_HOME: opts.stateDir } : {}),
80
+ // The launcher's own entry, so the in-session /plugin panel and
81
+ // /reload-plugins can run `yagni plugin …` with the same binary.
82
+ YAGNI_CLI_PATH: resolveCliPath(),
79
83
  // Forward the launcher's version so the extension's crash reports carry
80
84
  // the shipping version (the bundled extension has no package.json to read).
81
85
  ...(opts.cliVersion ? { YAGNI_CODE_VERSION: opts.cliVersion } : {}),
@@ -106,9 +110,9 @@ export function buildLaunch(creds, passthroughArgs, opts) {
106
110
  // the editor (which the launcher pads by seeding editorPaddingX). The
107
111
  // footer can't read pi's settings, so the value crosses over env.
108
112
  [PAD_X_ENV]: String(resolvePadX()),
109
- // OTel export (gated in otel.ts): pin metadata-only capture and forward
110
- // pi-otel's path so /go stage children and subagents load it too. Placed
111
- // after baseEnv on purpose the capture pin must beat a user env override.
113
+ // OTel export (gated in otel.ts): the YAGNI_OTEL_EXPORT gate plus the
114
+ // workspace's OTLP env; the bundled extension does the exporting, and
115
+ // /go stage children and subagents inherit this env so they export too.
112
116
  ...(opts.otel ? otelChildEnv(opts.otel, opts.baseEnv ?? {}) : {}),
113
117
  };
114
118
  // Always load our extension. Default the provider to `yagni` unless the user
@@ -130,7 +134,6 @@ export function buildLaunch(creds, passthroughArgs, opts) {
130
134
  const argv = [
131
135
  "-e",
132
136
  opts.extensionPath,
133
- ...(opts.otel ? ["-e", opts.otel.extensionPath] : []),
134
137
  ...(userChoseProvider ? [] : ["--provider", "yagni"]),
135
138
  ...(userChoseModel ? [] : ["--model", "advanced"]),
136
139
  ...(enrichmentOff ? [] : ["--append-system-prompt", ENGINEERING_PRACTICE_SECTION]),
@@ -0,0 +1,122 @@
1
+ /**
2
+ * `yagni mcp …` — configure MCP servers for YAGNI Code, mirroring Claude
3
+ * Code's CLI surface (add / add-json / remove / get / list /
4
+ * reset-project-choices / add-from-claude).
5
+ *
6
+ * The config module itself lives in pi-extension-yagni (`src/mcp/config.ts`)
7
+ * so the extension session and this CLI read and write the exact same files
8
+ * through the exact same code — loaded here by file path, the same pattern as
9
+ * the session-worktree and headless-go entries. `list` and `get` run real
10
+ * health-check connections (stdio servers are spawned), so they carry the
11
+ * same caution Claude Code prints: only run in directories you trust.
12
+ *
13
+ * Not implemented (deliberate deviations from Claude Code):
14
+ * serve — the YAGNI backend already exposes an MCP endpoint
15
+ * login — enterprise-IdP only in Claude Code; not applicable
16
+ */
17
+ export interface McpDeps {
18
+ cwd?: string;
19
+ home?: string;
20
+ env?: NodeJS.ProcessEnv;
21
+ stdout?: (text: string) => void;
22
+ stderr?: (text: string) => void;
23
+ /** Test seam: the extension module to import (defaults to the built copy). */
24
+ loadMcpModule?: () => Promise<McpCliModule>;
25
+ /**
26
+ * Test seam: the plugin MCP payload the launcher would hand a session
27
+ * (defaults to running the real, non-interactive discovery). Lets `list`
28
+ * and `get` show plugin-bundled servers outside a session.
29
+ */
30
+ pluginMcpEnv?: () => Promise<string | undefined>;
31
+ /** Test seam: health probe override (defaults to mod.probeServer). */
32
+ probeServer?: (name: string, config: unknown, opts?: {
33
+ env?: NodeJS.ProcessEnv;
34
+ }) => Promise<{
35
+ status: "connected" | "needs_auth" | "failed";
36
+ error?: string;
37
+ }>;
38
+ }
39
+ /** The structural slice of the extension's mcp config surface this file needs. */
40
+ export interface McpCliModule {
41
+ loadMcpServers(cwd: string, env: NodeJS.ProcessEnv): McpLoadResult;
42
+ mcpConfigPath(): string;
43
+ PROJECT_CONFIG_FILENAME: string;
44
+ writeUserMcpConfig(file: unknown): void;
45
+ readUserMcpConfig(): {
46
+ file: unknown;
47
+ errors: unknown[];
48
+ };
49
+ resolveProjectRoot(cwd: string): string;
50
+ resetProjectChoices(repoRoot: string): {
51
+ errors: unknown[];
52
+ };
53
+ decisionFor(state: unknown, serverName: string): "enabled" | "disabled" | "undecided";
54
+ readProjectApproval(repoRoot: string): {
55
+ state: unknown;
56
+ errors: unknown[];
57
+ };
58
+ updateStoredOAuthEntry(serverName: string, config: unknown, mutate: (entry: {
59
+ clientSecret?: string;
60
+ }) => void): {
61
+ errors: unknown[];
62
+ };
63
+ revokeTokensOnRemove(serverName: string, config: unknown, deps?: {
64
+ fetch?: typeof fetch;
65
+ }): Promise<void>;
66
+ getStoredOAuthEntry(serverName: string, config: unknown): {
67
+ clientSecret?: string;
68
+ } | undefined;
69
+ probeServer(name: string, config: unknown, opts?: {
70
+ connectTimeoutMs?: number;
71
+ env?: NodeJS.ProcessEnv;
72
+ }): Promise<{
73
+ status: "connected" | "needs_auth" | "failed";
74
+ error?: string;
75
+ }>;
76
+ /** ${VAR} expansion over a full server config (url, headers, command, args, env values). */
77
+ expandServerEnv?(config: unknown, env?: NodeJS.ProcessEnv): {
78
+ config: unknown;
79
+ missingVars: string[];
80
+ };
81
+ }
82
+ export type McpListScope = "user" | "project" | "local" | "plugin";
83
+ export interface McpLoadResult {
84
+ servers: {
85
+ name: string;
86
+ scope: McpListScope;
87
+ config: Record<string, unknown>;
88
+ sourcePath: string;
89
+ plugin?: string;
90
+ gated?: boolean;
91
+ }[];
92
+ errors: {
93
+ sourcePath: string;
94
+ serverName?: string;
95
+ message: string;
96
+ }[];
97
+ }
98
+ export declare function resolveMcpConfigPath(): string;
99
+ export interface ParsedMcpArgs {
100
+ subcommand: string | undefined;
101
+ name?: string;
102
+ rest: string[];
103
+ scope: "local" | "user" | "project";
104
+ /** Whether -s/--scope appeared explicitly (remove without it acts across scopes). */
105
+ scopeExplicit: boolean;
106
+ transport: "stdio" | "sse" | "http";
107
+ /** Whether -t/--transport appeared explicitly (drives the URL-misread warning). */
108
+ transportExplicit: boolean;
109
+ env: Record<string, string>;
110
+ headers: Record<string, string>;
111
+ /** Positionals after the subcommand's own first two (stdio command args). */
112
+ commandArgs: string[];
113
+ /** OAuth client id (-only). */
114
+ clientId?: string;
115
+ /** Whether --client-secret was passed (prompt/env-read the secret). */
116
+ clientSecret: boolean;
117
+ /** Fixed loopback callback port. */
118
+ callbackPort?: number;
119
+ }
120
+ export declare function parseMcpArgs(argv: string[]): ParsedMcpArgs;
121
+ export declare function mcpCommand(args: string[], deps?: McpDeps): Promise<number>;
122
+ //# sourceMappingURL=mcpCommand.d.ts.map