my-pi 0.3.1 → 0.3.3

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/README.md CHANGED
@@ -168,6 +168,13 @@ pnpx my-pi@latest
168
168
  pnpx my-pi@latest observability
169
169
  ```
170
170
 
171
+ Positional prompt arguments are joined with a single space. Everything
172
+ following `--` is prompt text, including tokens that look like
173
+ options. A non-empty `--prompt` (`-p`) value takes precedence over
174
+ positional text; stdin is used only when neither supplies a prompt.
175
+ `--mode json` and `--json` both select NDJSON output; `--mode print`
176
+ and `-P` both select plain text output.
177
+
171
178
  Pi handles model authentication natively. For provider-specific model
172
179
  examples, see the Pi docs and the relevant extension/package README.
173
180
 
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ function parse_extension_cli_args(argv, known_args) {
54
54
  const flag_token = equals_index === -1 ? arg : arg.slice(0, equals_index);
55
55
  const known_type = known_flags.get(flag_token);
56
56
  if (known_type) {
57
- if (equals_index === -1 && (known_type === "string" || known_type === "enum") && i + 1 < argv.length) i += 1;
57
+ if (equals_index === -1 && (known_type === "string" || known_type === "enum") && i + 1 < argv.length && argv[i + 1] !== "--") i += 1;
58
58
  continue;
59
59
  }
60
60
  if (arg.startsWith("--")) {
@@ -87,6 +87,7 @@ function collect_flag_values(argv, flags) {
87
87
  const flag_set = new Set(flags);
88
88
  for (let i = 0; i < argv.length; i++) {
89
89
  const arg = argv[i];
90
+ if (arg === "--") break;
90
91
  if (!arg) continue;
91
92
  const equals_index = arg.indexOf("=");
92
93
  if (equals_index !== -1) {
@@ -96,7 +97,7 @@ function collect_flag_values(argv, flags) {
96
97
  }
97
98
  if (flag_set.has(arg) && i + 1 < argv.length) {
98
99
  const next = argv[i + 1];
99
- if (next !== void 0) {
100
+ if (next !== void 0 && next !== "--") {
100
101
  values.push(next);
101
102
  i += 1;
102
103
  }
@@ -236,6 +237,9 @@ NOTES
236
237
  MCP, LSP, prompt presets, recall, nopeek, Omnisearch, SQLite tools, hooks, and secret redaction.
237
238
  - UI-only built-ins like session auto-naming are skipped.
238
239
  - Repeat -e / --extension to compose multiple extensions.
240
+ - Positional prompt arguments are joined with a single space.
241
+ - Everything after -- is prompt text, not options.
242
+ - --prompt takes precedence over positional prompt text and stdin.
239
243
 
240
244
  NESTED RUNS
241
245
 
@@ -411,15 +415,16 @@ const main = defineCommand({
411
415
  },
412
416
  async run({ args }) {
413
417
  const cwd = process.cwd();
414
- const parsed_extension_cli = parse_extension_cli_args(process.argv.slice(2), main.args);
418
+ const cli_argv = process.argv.slice(2);
419
+ const parsed_extension_cli = parse_extension_cli_args(cli_argv, main.args);
415
420
  if (parsed_extension_cli.diagnostics.length) {
416
421
  for (const message of parsed_extension_cli.diagnostics) console.error(`Error: ${message}`);
417
422
  process.exit(1);
418
423
  }
419
- const extension_paths = parse_extension_paths(process.argv, cwd);
420
- const selected_tools = parse_tool_allowlist(process.argv);
421
- const excluded_tools = parse_tool_excludelist(process.argv);
422
- const selected_skills = parse_skill_allowlist(process.argv);
424
+ const extension_paths = parse_extension_paths(cli_argv, cwd);
425
+ const selected_tools = parse_tool_allowlist(cli_argv);
426
+ const excluded_tools = parse_tool_excludelist(cli_argv);
427
+ const selected_skills = parse_skill_allowlist(cli_argv);
423
428
  let selected_thinking;
424
429
  try {
425
430
  selected_thinking = parse_thinking_level(args.thinking);
@@ -450,10 +455,10 @@ const main = defineCommand({
450
455
  return;
451
456
  }
452
457
  let prompt = args.prompt;
453
- if (!prompt && positionals && positionals.length > 0) prompt = positionals[0];
458
+ if (!prompt && positionals && positionals.length > 0) prompt = positionals.join(" ");
454
459
  if (!prompt && !process.stdin.isTTY && runtime_mode !== "rpc") prompt = await read_stdin();
455
460
  if (prompt && runtime_mode === "interactive") runtime_mode = "print";
456
- if (!args.print && !args.json && runtime_mode !== "rpc" && !prompt && !process.stdout.isTTY) {
461
+ if (runtime_mode === "interactive" && !prompt && !process.stdout.isTTY) {
457
462
  await print_usage(main);
458
463
  return;
459
464
  }
@@ -501,11 +506,9 @@ const main = defineCommand({
501
506
  process.exit(1);
502
507
  }
503
508
  if (runtime_mode === "rpc") await runRpcMode(runtime);
504
- else if (args.print || args.json || prompt) {
505
- let output_mode = "text";
506
- if (args.json) output_mode = "json";
509
+ else if (runtime_mode === "print" || runtime_mode === "json") {
507
510
  const code = await runPrintMode(runtime, {
508
- mode: output_mode,
511
+ mode: runtime_mode === "json" ? "json" : "text",
509
512
  initialMessage: prompt || "",
510
513
  initialImages: [],
511
514
  messages: []
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/cli-args.ts","../src/runtime-preflight.ts","../src/warnings.ts","../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport {\n\tBUILTIN_EXTENSIONS,\n\ttype BuiltinExtensionOptionName,\n} from './extensions/builtin-registry.js';\n\nconst THINKING_LEVELS = new Set([\n\t'off',\n\t'minimal',\n\t'low',\n\t'medium',\n\t'high',\n\t'xhigh',\n]);\n\nexport type CliThinkingLevel =\n\t| 'off'\n\t| 'minimal'\n\t| 'low'\n\t| 'medium'\n\t| 'high'\n\t| 'xhigh';\n\nexport type BuiltinDisableCliArgs = Record<\n\tstring,\n\t{\n\t\ttype: 'boolean';\n\t\tdescription: string;\n\t\tdefault: false;\n\t}\n>;\n\nexport interface CliArgDefinition {\n\ttype: 'boolean' | 'string' | 'enum' | 'positional';\n\talias?: string | readonly string[];\n}\n\nexport type CliArgDefinitions = Record<string, CliArgDefinition>;\n\nexport interface ParsedExtensionCliArgs {\n\textension_flag_values: Map<string, boolean | string>;\n\tpositionals: string[];\n\tdiagnostics: string[];\n}\n\nexport function create_builtin_disable_cli_args(): BuiltinDisableCliArgs {\n\treturn Object.fromEntries(\n\t\tBUILTIN_EXTENSIONS.map((extension) => [\n\t\t\textension.cli_arg,\n\t\t\t{\n\t\t\t\ttype: 'boolean' as const,\n\t\t\t\tdescription: extension.cli_description,\n\t\t\t\tdefault: false as const,\n\t\t\t},\n\t\t]),\n\t);\n}\n\nfunction is_citty_no_flag_set(\n\targs: Record<string, unknown>,\n\tcli_arg: string,\n): boolean {\n\tif (args[cli_arg]) return true;\n\n\tconst positive_kebab = cli_arg.replace(/^no-/, '');\n\tconst positive_camel = positive_kebab.replace(\n\t\t/-([a-z])/g,\n\t\t(_, char) => String(char).toUpperCase(),\n\t);\n\treturn (\n\t\targs[positive_kebab] === false || args[positive_camel] === false\n\t);\n}\n\nexport function resolve_builtin_extension_options(\n\targs: Record<string, unknown>,\n): Partial<Record<BuiltinExtensionOptionName, boolean>> {\n\tconst no_builtin = is_citty_no_flag_set(args, 'no-builtin');\n\treturn Object.fromEntries(\n\t\tBUILTIN_EXTENSIONS.map((extension) => [\n\t\t\textension.option_name,\n\t\t\t!no_builtin &&\n\t\t\t\t!is_citty_no_flag_set(args, extension.cli_arg) &&\n\t\t\t\textension.default_enabled,\n\t\t]),\n\t) as Partial<Record<BuiltinExtensionOptionName, boolean>>;\n}\n\nexport function parse_extension_cli_args(\n\targv: string[],\n\tknown_args: CliArgDefinitions,\n): ParsedExtensionCliArgs {\n\tconst known_flags = new Map<string, CliArgDefinition['type']>();\n\tfor (const [name, definition] of Object.entries(known_args)) {\n\t\tknown_flags.set(`--${name}`, definition.type);\n\t\tconst camel_name = name.replace(/-([a-z])/g, (_, char) =>\n\t\t\tString(char).toUpperCase(),\n\t\t);\n\t\tknown_flags.set(`--${camel_name}`, definition.type);\n\t\tif (definition.type === 'boolean')\n\t\t\tknown_flags.set(`--no-${name}`, definition.type);\n\t\tconst aliases = Array.isArray(definition.alias)\n\t\t\t? definition.alias\n\t\t\t: definition.alias\n\t\t\t\t? [definition.alias]\n\t\t\t\t: [];\n\t\tfor (const alias of aliases)\n\t\t\tknown_flags.set(`-${alias}`, definition.type);\n\t}\n\n\tconst extension_flag_values = new Map<string, boolean | string>();\n\tconst positionals: string[] = [];\n\tconst diagnostics: string[] = [];\n\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tconst arg = argv[i];\n\t\tif (!arg) continue;\n\t\tif (arg === '--') {\n\t\t\tpositionals.push(...argv.slice(i + 1));\n\t\t\tbreak;\n\t\t}\n\n\t\tconst equals_index = arg.indexOf('=');\n\t\tconst flag_token =\n\t\t\tequals_index === -1 ? arg : arg.slice(0, equals_index);\n\t\tconst known_type = known_flags.get(flag_token);\n\t\tif (known_type) {\n\t\t\tif (\n\t\t\t\tequals_index === -1 &&\n\t\t\t\t(known_type === 'string' || known_type === 'enum') &&\n\t\t\t\ti + 1 < argv.length\n\t\t\t) {\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg.startsWith('--')) {\n\t\t\tif (equals_index !== -1) {\n\t\t\t\textension_flag_values.set(\n\t\t\t\t\targ.slice(2, equals_index),\n\t\t\t\t\targ.slice(equals_index + 1),\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst name = arg.slice(2);\n\t\t\tconst next = argv[i + 1];\n\t\t\tif (\n\t\t\t\tnext !== undefined &&\n\t\t\t\t!next.startsWith('-') &&\n\t\t\t\t!next.startsWith('@')\n\t\t\t) {\n\t\t\t\textension_flag_values.set(name, next);\n\t\t\t\ti += 1;\n\t\t\t} else {\n\t\t\t\textension_flag_values.set(name, true);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg.startsWith('-')) {\n\t\t\tdiagnostics.push(`Unknown option: ${arg}`);\n\t\t\tcontinue;\n\t\t}\n\t\tpositionals.push(arg);\n\t}\n\n\treturn { extension_flag_values, positionals, diagnostics };\n}\n\nexport function collect_flag_values(\n\targv: string[],\n\tflags: readonly string[],\n): string[] {\n\tconst values: string[] = [];\n\tconst flag_set = new Set(flags);\n\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tconst arg = argv[i];\n\t\tif (!arg) continue;\n\n\t\tconst equals_index = arg.indexOf('=');\n\t\tif (equals_index !== -1) {\n\t\t\tconst name = arg.slice(0, equals_index);\n\t\t\tif (flag_set.has(name)) {\n\t\t\t\tvalues.push(arg.slice(equals_index + 1));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (flag_set.has(arg) && i + 1 < argv.length) {\n\t\t\tconst next = argv[i + 1];\n\t\t\tif (next !== undefined) {\n\t\t\t\tvalues.push(next);\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn values;\n}\n\nexport function parse_extension_paths(\n\targv: string[],\n\tcwd = process.cwd(),\n): string[] {\n\treturn collect_flag_values(argv, ['-e', '--extension'])\n\t\t.map((path) => path.trim())\n\t\t.filter(Boolean)\n\t\t.map((path) => resolve(cwd, path));\n}\n\nfunction parse_comma_list_flags(\n\targv: string[],\n\tflags: readonly string[],\n): string[] | undefined {\n\tconst values = collect_flag_values(argv, flags)\n\t\t.flatMap((value) => value.split(','))\n\t\t.map((value) => value.trim())\n\t\t.filter(Boolean);\n\treturn values.length ? [...new Set(values)] : undefined;\n}\n\nexport function parse_tool_allowlist(\n\targv: string[],\n): string[] | undefined {\n\treturn parse_comma_list_flags(argv, ['--tools', '-t']);\n}\n\nexport function parse_tool_excludelist(\n\targv: string[],\n): string[] | undefined {\n\treturn parse_comma_list_flags(argv, ['--exclude-tools', '-xt']);\n}\n\nexport function parse_skill_allowlist(\n\targv: string[],\n): string[] | undefined {\n\treturn parse_comma_list_flags(argv, ['--skill']);\n}\n\nexport function parse_thinking_level(\n\tvalue: string | undefined,\n): CliThinkingLevel | undefined {\n\tconst normalized = value?.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\tif (!THINKING_LEVELS.has(normalized)) {\n\t\tthrow new Error(\n\t\t\t'--thinking must be one of: off, minimal, low, medium, high, xhigh.',\n\t\t);\n\t}\n\treturn normalized as CliThinkingLevel;\n}\n","export const MINIMUM_NODE_VERSION = '24.15.0';\n\nfunction parse_node_version(\n\tversion: string,\n): [number, number, number] | undefined {\n\tconst match = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:[-+].*)?$/.exec(version);\n\tif (!match) return undefined;\n\treturn [Number(match[1]), Number(match[2]), Number(match[3])];\n}\n\nexport function is_supported_node_version(version: string): boolean {\n\tconst current = parse_node_version(version);\n\tconst minimum = parse_node_version(MINIMUM_NODE_VERSION);\n\tif (!current || !minimum) return false;\n\n\tfor (let index = 0; index < current.length; index++) {\n\t\tif (current[index] > minimum[index]) return true;\n\t\tif (current[index] < minimum[index]) return false;\n\t}\n\treturn true;\n}\n\nexport function get_node_preflight_error(\n\tcurrent_version = process.versions.node,\n): string | undefined {\n\tif (is_supported_node_version(current_version)) return undefined;\n\treturn `my-pi requires Node >=${MINIMUM_NODE_VERSION}; current version is ${current_version}. Upgrade Node and retry.`;\n}\n","const SQLITE_EXPERIMENTAL_WARNING =\n\t'SQLite is an experimental feature';\nconst FILTER_INSTALLED = Symbol.for(\n\t'my-pi.sqlite-warning-filter-installed',\n);\nconst ORIGINAL_EMIT_WARNING = Symbol.for(\n\t'my-pi.original-emit-warning',\n);\n\ntype WarningEmitter = Pick<typeof process, 'emitWarning'> & {\n\t[FILTER_INSTALLED]?: boolean;\n\t[ORIGINAL_EMIT_WARNING]?: typeof process.emitWarning;\n};\n\nexport function should_suppress_warning(warning: Error): boolean {\n\treturn (\n\t\twarning.name === 'ExperimentalWarning' &&\n\t\twarning.message.includes(SQLITE_EXPERIMENTAL_WARNING)\n\t);\n}\n\nfunction should_suppress_emit_warning_args(args: unknown[]): boolean {\n\tconst [warning, options_or_type] = args;\n\tif (warning instanceof Error)\n\t\treturn should_suppress_warning(warning);\n\tconst warning_type =\n\t\ttypeof options_or_type === 'string'\n\t\t\t? options_or_type\n\t\t\t: options_or_type && typeof options_or_type === 'object'\n\t\t\t\t? (options_or_type as { type?: unknown }).type\n\t\t\t\t: undefined;\n\treturn (\n\t\twarning_type === 'ExperimentalWarning' &&\n\t\tString(warning).includes(SQLITE_EXPERIMENTAL_WARNING)\n\t);\n}\n\nexport function install_sqlite_warning_filter(\n\tprocess_like: WarningEmitter = process,\n): void {\n\tif (process_like[FILTER_INSTALLED]) return;\n\tprocess_like[FILTER_INSTALLED] = true;\n\n\tconst original_emit_warning =\n\t\tprocess_like[ORIGINAL_EMIT_WARNING] ?? process_like.emitWarning;\n\tprocess_like[ORIGINAL_EMIT_WARNING] = original_emit_warning;\n\n\tprocess_like.emitWarning = function emit_filtered_warning(\n\t\tthis: WarningEmitter,\n\t\t...args: unknown[]\n\t) {\n\t\tif (should_suppress_emit_warning_args(args)) return;\n\t\treturn (\n\t\t\toriginal_emit_warning as (...args: unknown[]) => void\n\t\t).apply(this, args);\n\t} as typeof process.emitWarning;\n}\n","#!/usr/bin/env node\n\nimport {\n\tdefineCommand,\n\trenderUsage,\n\trunMain,\n\ttype ArgsDef,\n\ttype CommandDef,\n} from 'citty';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport {\n\tcreate_builtin_disable_cli_args,\n\tparse_extension_cli_args,\n\tparse_extension_paths,\n\tparse_skill_allowlist,\n\tparse_thinking_level,\n\tparse_tool_allowlist,\n\tparse_tool_excludelist,\n\tresolve_builtin_extension_options,\n\ttype CliArgDefinitions,\n} from './cli-args.js';\nimport { get_node_preflight_error } from './runtime-preflight.js';\nimport { install_sqlite_warning_filter } from './warnings.js';\n\nconst node_preflight_error = get_node_preflight_error();\nif (node_preflight_error) {\n\tconsole.error(node_preflight_error);\n\tprocess.exit(1);\n}\n\ninstall_sqlite_warning_filter();\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst package_root = join(__dirname, '..');\nconst pkg = JSON.parse(\n\treadFileSync(join(package_root, 'package.json'), 'utf-8'),\n);\n\n// my-pi is a wrapper around Pi; upstream Pi update banners are useful in\n// this repo, but confusing for installed wrapper users.\nif (!existsSync(join(package_root, '.git'))) {\n\tprocess.env.PI_SKIP_VERSION_CHECK ??= '1';\n}\n\nasync function read_stdin(): Promise<string> {\n\tconst chunks: Buffer[] = [];\n\tfor await (const chunk of process.stdin) {\n\t\tchunks.push(chunk as Buffer);\n\t}\n\treturn Buffer.concat(chunks).toString('utf-8').trim();\n}\n\ntype MyPiRuntime = Awaited<\n\tReturnType<(typeof import('./api.js'))['create_my_pi']>\n>;\ntype InteractiveModeConstructor =\n\t(typeof import('@earendil-works/pi-coding-agent'))['InteractiveMode'];\n\nasync function run_interactive_mode(\n\truntime: MyPiRuntime,\n\tInteractiveModeClass: InteractiveModeConstructor,\n): Promise<void> {\n\tconst original_write = process.stdout.write.bind(process.stdout);\n\tprocess.stdout.write = ((\n\t\tchunk: string | Uint8Array,\n\t\t...args: Parameters<typeof original_write>\n\t) => {\n\t\tif (typeof chunk === 'string') {\n\t\t\tconst escape = String.fromCharCode(27);\n\t\t\tconst styled_hint = new RegExp(\n\t\t\t\t`(To resume this session:${escape}\\\\[[\\\\d;]*m )pi( --session )`,\n\t\t\t\t'g',\n\t\t\t);\n\t\t\tchunk = chunk.replace(styled_hint, '$1my-pi$2');\n\t\t\tchunk = chunk.replace(\n\t\t\t\t/(To resume this session: )pi( --session )/g,\n\t\t\t\t'$1my-pi$2',\n\t\t\t);\n\t\t}\n\t\treturn Reflect.apply(original_write, process.stdout, [\n\t\t\tchunk,\n\t\t\t...args,\n\t\t]);\n\t}) as typeof process.stdout.write;\n\ttry {\n\t\tconst mode = new InteractiveModeClass(runtime, {\n\t\t\tmigratedProviders: [],\n\t\t\tmodelFallbackMessage: undefined,\n\t\t\tinitialMessage: undefined,\n\t\t\tinitialImages: [],\n\t\t\tinitialMessages: [],\n\t\t});\n\t\tawait mode.run();\n\t} finally {\n\t\tprocess.stdout.write =\n\t\t\toriginal_write as typeof process.stdout.write;\n\t}\n}\n\nconst HELP_APPENDIX = `\nMODES\n\n my-pi\n Interactive TUI with slash commands, editor, and session UI.\n\n my-pi \"prompt\"\n my-pi -P \"prompt\"\n One-shot print mode with plain text output.\n\n my-pi --json \"prompt\"\n Non-interactive NDJSON mode for scripts, evals, and other agents.\n\n my-pi --mode rpc\n RPC mode over stdin/stdout JSONL for orchestrators and teammate sessions.\n\nNOTES\n\n - In non-interactive modes, my-pi keeps headless-capable built-ins like\n MCP, LSP, prompt presets, recall, nopeek, Omnisearch, SQLite tools, hooks, and secret redaction.\n - UI-only built-ins like session auto-naming are skipped.\n - Repeat -e / --extension to compose multiple extensions.\n\nNESTED RUNS\n\n - Child runs inherit cwd and environment unless you isolate them explicitly.\n - Use --agent-dir to isolate auth, config, sessions, and telemetry state.\n - For safer evals or unknown repos, use --untrusted plus an explicit\n --system-prompt.\n\nEXAMPLES\n\n my-pi\n my-pi \"fix the failing test\"\n my-pi -P \"summarize this repo\"\n my-pi --json \"list all TODO comments\"\n echo \"plan a login page\" | my-pi --json\n my-pi --telemetry --json \"run eval case\"\n my-pi --telemetry --telemetry-db ./tmp/evals.db --json \"run case\"\n my-pi observability\n my-pi --untrusted --agent-dir /tmp/pi-agent --json \"run case\"\n my-pi -e ./my-ext.ts -e ./other-ext.ts \"hello\"\n my-pi -m claude-haiku-4-5-20241022 \"explain this file\"\n XIAOMI_API_KEY=... my-pi -m xiaomi/mimo-v2.5-pro \"summarize this repo\"\n my-pi -m cloudflare-workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast \"explain this file\"\n my-pi --preset terse,no-purple-prose \"summarize this repo\"\n my-pi --system-prompt \"You are a JSON classifier. Return only JSON.\" --json \"classify this\"\n\nPROMPT PRESETS\n\n Interactive commands:\n /prompt-preset help\n /prompt-preset export-defaults\n /prompt-preset edit-global terse\n /prompt-preset base detailed\n /prompt-preset enable bullets\n\n Short alias: /preset\n\n Editable preset files:\n ~/.pi/agent/presets/*.md\n .pi/presets/*.md\n`;\n\nasync function render_rich_usage<T extends ArgsDef>(\n\tcmd: CommandDef<T>,\n\tparent?: CommandDef<T>,\n): Promise<string> {\n\treturn `${await renderUsage(cmd, parent)}\\n${HELP_APPENDIX}`;\n}\n\nasync function print_usage<T extends ArgsDef>(\n\tcmd: CommandDef<T>,\n\tparent?: CommandDef<T>,\n): Promise<void> {\n\tconsole.log(await render_rich_usage(cmd, parent));\n}\n\nconst main = defineCommand({\n\tmeta: {\n\t\tname: 'my-pi',\n\t\tversion: pkg.version,\n\t\tdescription:\n\t\t\t'Composable pi coding agent with MCP, LSP, presets, and local eval telemetry',\n\t},\n\targs: {\n\t\tprint: {\n\t\t\ttype: 'boolean',\n\t\t\talias: 'P',\n\t\t\tdescription: 'Print mode (non-interactive, one-shot)',\n\t\t\tdefault: false,\n\t\t},\n\t\t'agent-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override Pi auth/config/session directory for this process',\n\t\t\trequired: false,\n\t\t},\n\t\t'session-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override Pi session storage directory for this process',\n\t\t\trequired: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\talias: 'j',\n\t\t\tdescription: 'Output NDJSON events (for agent consumption)',\n\t\t\tdefault: false,\n\t\t},\n\t\tmode: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Runtime mode: interactive, print, json, or rpc',\n\t\t\trequired: false,\n\t\t},\n\t\textension: {\n\t\t\ttype: 'string',\n\t\t\talias: 'e',\n\t\t\tdescription:\n\t\t\t\t'Extension path to load; repeatable via argv parsing',\n\t\t\trequired: false,\n\t\t},\n\t\t'no-builtin': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Disable all built-in extensions',\n\t\t\tdefault: false,\n\t\t},\n\t\tuntrusted: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription:\n\t\t\t\t'Safe mode for unknown repos: skip project MCP, hooks, project prompt presets, project skills, and project LSP binaries unless explicitly re-enabled',\n\t\t\tdefault: false,\n\t\t},\n\t\t...create_builtin_disable_cli_args(),\n\t\ttelemetry: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Enable local SQLite telemetry for this process',\n\t\t\tdefault: false,\n\t\t},\n\t\t'no-telemetry': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Disable local SQLite telemetry for this process',\n\t\t\tdefault: false,\n\t\t},\n\t\t'telemetry-db': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override telemetry database path for this process',\n\t\t\trequired: false,\n\t\t},\n\t\tmodel: {\n\t\t\ttype: 'string',\n\t\t\talias: 'm',\n\t\t\tdescription:\n\t\t\t\t'Model to use (e.g. claude-sonnet-4-5-20241022, gpt-5.4, cloudflare-workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast)',\n\t\t},\n\t\tthinking: {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Thinking level: off, minimal, low, medium, high, or xhigh',\n\t\t\trequired: false,\n\t\t},\n\t\ttools: {\n\t\t\ttype: 'string',\n\t\t\talias: 't',\n\t\t\tdescription:\n\t\t\t\t'Comma-separated allowlist of tool names to enable',\n\t\t\trequired: false,\n\t\t},\n\t\t'exclude-tools': {\n\t\t\ttype: 'string',\n\t\t\talias: 'xt',\n\t\t\tdescription: 'Comma-separated list of tool names to disable',\n\t\t\trequired: false,\n\t\t},\n\t\tsession: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Resume a specific session file or session ID',\n\t\t\trequired: false,\n\t\t},\n\t\t'session-id': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Create or resume an exact project-local session ID',\n\t\t\trequired: false,\n\t\t},\n\t\tname: {\n\t\t\ttype: 'string',\n\t\t\talias: 'n',\n\t\t\tdescription: 'Set the session display name at startup',\n\t\t\trequired: false,\n\t\t},\n\t\tskill: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Skill name to allow; repeatable in argv parsing',\n\t\t\trequired: false,\n\t\t},\n\t\t'system-prompt': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Replace the base system prompt',\n\t\t\trequired: false,\n\t\t},\n\t\t'append-system-prompt': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Append one-off instructions to the system prompt',\n\t\t\trequired: false,\n\t\t},\n\t\tprompt: {\n\t\t\ttype: 'string',\n\t\t\talias: 'p',\n\t\t\tdescription: 'Prompt text (alternative to positional argument)',\n\t\t\trequired: false,\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst cwd = process.cwd();\n\t\tconst parsed_extension_cli = parse_extension_cli_args(\n\t\t\tprocess.argv.slice(2),\n\t\t\tmain.args as CliArgDefinitions,\n\t\t);\n\t\tif (parsed_extension_cli.diagnostics.length) {\n\t\t\tfor (const message of parsed_extension_cli.diagnostics)\n\t\t\t\tconsole.error(`Error: ${message}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tconst extension_paths = parse_extension_paths(process.argv, cwd);\n\t\tconst selected_tools = parse_tool_allowlist(process.argv);\n\t\tconst excluded_tools = parse_tool_excludelist(process.argv);\n\t\tconst selected_skills = parse_skill_allowlist(process.argv);\n\t\tlet selected_thinking;\n\t\ttry {\n\t\t\tselected_thinking = parse_thinking_level(args.thinking);\n\t\t} catch (error) {\n\t\t\tconsole.error(\n\t\t\t\terror instanceof Error ? error.message : String(error),\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tlet runtime_mode: 'interactive' | 'print' | 'json' | 'rpc' =\n\t\t\t'interactive';\n\t\tif (args.mode) {\n\t\t\tconst requested = String(args.mode).trim().toLowerCase();\n\t\t\tif (\n\t\t\t\t!['interactive', 'print', 'json', 'rpc'].includes(requested)\n\t\t\t) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Error: --mode must be one of interactive, print, json, rpc.',\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\truntime_mode = requested as\n\t\t\t\t| 'interactive'\n\t\t\t\t| 'print'\n\t\t\t\t| 'json'\n\t\t\t\t| 'rpc';\n\t\t}\n\t\tif (args.json) runtime_mode = 'json';\n\t\telse if (args.print) runtime_mode = 'print';\n\n\t\tconst positionals = parsed_extension_cli.positionals;\n\t\tif (positionals?.[0] === 'observability') {\n\t\t\tconst { start_observability_server } =\n\t\t\t\tawait import('@spences10/pi-observability/server');\n\t\t\tstart_observability_server();\n\t\t\treturn;\n\t\t}\n\n\t\t// Resolve prompt: named --prompt flag > positional > stdin\n\t\tlet prompt = args.prompt;\n\t\tif (!prompt && positionals && positionals.length > 0) {\n\t\t\tprompt = positionals[0];\n\t\t}\n\t\tif (!prompt && !process.stdin.isTTY && runtime_mode !== 'rpc') {\n\t\t\tprompt = await read_stdin();\n\t\t}\n\t\tif (prompt && runtime_mode === 'interactive')\n\t\t\truntime_mode = 'print';\n\n\t\tif (\n\t\t\t!args.print &&\n\t\t\t!args.json &&\n\t\t\truntime_mode !== 'rpc' &&\n\t\t\t!prompt &&\n\t\t\t!process.stdout.isTTY\n\t\t) {\n\t\t\tawait print_usage(main);\n\t\t\treturn;\n\t\t}\n\n\t\t// Startup feedback so silence = broken (issue #3)\n\t\tif (runtime_mode !== 'interactive') {\n\t\t\tprocess.stderr.write(\n\t\t\t\t`my-pi: connecting to ${args.model || 'default model'}...\\n`,\n\t\t\t);\n\t\t}\n\n\t\tif (args.telemetry && args['no-telemetry']) {\n\t\t\tconsole.error(\n\t\t\t\t'Error: --telemetry and --no-telemetry cannot be used together.',\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tif (args.session && args['session-id']) {\n\t\t\tconsole.error(\n\t\t\t\t'Error: --session and --session-id cannot be used together.',\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tlet telemetry_override: boolean | undefined;\n\t\tif (args.telemetry) {\n\t\t\ttelemetry_override = true;\n\t\t} else if (args['no-telemetry']) {\n\t\t\ttelemetry_override = false;\n\t\t}\n\n\t\tconst [\n\t\t\t{ create_my_pi },\n\t\t\t{ InteractiveMode, runPrintMode, runRpcMode },\n\t\t] = await Promise.all([\n\t\t\timport('./api.js'),\n\t\t\timport('@earendil-works/pi-coding-agent'),\n\t\t]);\n\n\t\tconst runtime = await create_my_pi({\n\t\t\tcwd,\n\t\t\tagent_dir: args['agent-dir'],\n\t\t\tsession_dir: args['session-dir'],\n\t\t\textensions: extension_paths,\n\t\t\textension_flag_values:\n\t\t\t\tparsed_extension_cli.extension_flag_values,\n\t\t\truntime_mode,\n\t\t\t...resolve_builtin_extension_options(args),\n\t\t\ttelemetry: telemetry_override,\n\t\t\ttelemetry_db_path: args['telemetry-db'],\n\t\t\tmodel: args.model,\n\t\t\tthinking: selected_thinking,\n\t\t\tselected_tools,\n\t\t\texcluded_tools,\n\t\t\tselected_skills,\n\t\t\tsession: args.session,\n\t\t\tsession_id: args['session-id'],\n\t\t\tstartup_session_name: args.name,\n\t\t\tsystem_prompt: args['system-prompt'],\n\t\t\tappend_system_prompt: args['append-system-prompt'],\n\t\t\tuntrusted_repo: args.untrusted,\n\t\t});\n\n\t\tfor (const diagnostic of runtime.diagnostics) {\n\t\t\tconst prefix =\n\t\t\t\tdiagnostic.type === 'error'\n\t\t\t\t\t? 'Error: '\n\t\t\t\t\t: diagnostic.type === 'warning'\n\t\t\t\t\t\t? 'Warning: '\n\t\t\t\t\t\t: '';\n\t\t\tconsole.error(`${prefix}${diagnostic.message}`);\n\t\t}\n\t\tif (\n\t\t\truntime.diagnostics.some(\n\t\t\t\t(diagnostic) => diagnostic.type === 'error',\n\t\t\t)\n\t\t) {\n\t\t\tawait runtime.dispose();\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tif (runtime_mode === 'rpc') {\n\t\t\tawait runRpcMode(runtime);\n\t\t} else if (args.print || args.json || prompt) {\n\t\t\tlet output_mode: 'json' | 'text' = 'text';\n\t\t\tif (args.json) {\n\t\t\t\toutput_mode = 'json';\n\t\t\t}\n\t\t\tconst code = await runPrintMode(runtime, {\n\t\t\t\tmode: output_mode,\n\t\t\t\tinitialMessage: prompt || '',\n\t\t\t\tinitialImages: [],\n\t\t\t\tmessages: [],\n\t\t\t});\n\t\t\tprocess.exit(code);\n\t\t} else if (!process.stdout.isTTY) {\n\t\t\tawait print_usage(main);\n\t\t} else {\n\t\t\tawait run_interactive_mode(runtime, InteractiveMode);\n\t\t}\n\t},\n});\n\nvoid runMain(main, {\n\tshowUsage: async (cmd, parent) => {\n\t\tawait print_usage(cmd, parent);\n\t},\n});\n"],"mappings":";;;;;;;AAMA,MAAM,kCAAkB,IAAI,IAAI;CAC/B;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAgCD,SAAgB,kCAAyD;CACxE,OAAO,OAAO,YACb,mBAAmB,KAAK,cAAc,CACrC,UAAU,SACV;EACC,MAAM;EACN,aAAa,UAAU;EACvB,SAAS;CACV,CACD,CAAC,CACF;AACD;AAEA,SAAS,qBACR,MACA,SACU;CACV,IAAI,KAAK,UAAU,OAAO;CAE1B,MAAM,iBAAiB,QAAQ,QAAQ,QAAQ,EAAE;CACjD,MAAM,iBAAiB,eAAe,QACrC,cACC,GAAG,SAAS,OAAO,IAAI,CAAC,CAAC,YAAY,CACvC;CACA,OACC,KAAK,oBAAoB,SAAS,KAAK,oBAAoB;AAE7D;AAEA,SAAgB,kCACf,MACuD;CACvD,MAAM,aAAa,qBAAqB,MAAM,YAAY;CAC1D,OAAO,OAAO,YACb,mBAAmB,KAAK,cAAc,CACrC,UAAU,aACV,CAAC,cACA,CAAC,qBAAqB,MAAM,UAAU,OAAO,KAC7C,UAAU,eACZ,CAAC,CACF;AACD;AAEA,SAAgB,yBACf,MACA,YACyB;CACzB,MAAM,8BAAc,IAAI,IAAsC;CAC9D,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,UAAU,GAAG;EAC5D,YAAY,IAAI,KAAK,QAAQ,WAAW,IAAI;EAC5C,MAAM,aAAa,KAAK,QAAQ,cAAc,GAAG,SAChD,OAAO,IAAI,CAAC,CAAC,YAAY,CAC1B;EACA,YAAY,IAAI,KAAK,cAAc,WAAW,IAAI;EAClD,IAAI,WAAW,SAAS,WACvB,YAAY,IAAI,QAAQ,QAAQ,WAAW,IAAI;EAChD,MAAM,UAAU,MAAM,QAAQ,WAAW,KAAK,I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AAU,MAAM,aAAa;GAClC;GACA,WAAW,KAAK;GAChB,aAAa,KAAK;GAClB,YAAY;GACZ,uBACC,qBAAqB;GACtB;GACA,GAAG,kCAAkC,IAAI;GACzC,WAAW;GACX,mBAAmB,KAAK;GACxB,OAAO,KAAK;GACZ,UAAU;GACV;GACA;GACA;GACA,SAAS,KAAK;GACd,YAAY,KAAK;GACjB,sBAAsB,KAAK;GAC3B,eAAe,KAAK;GACpB,sBAAsB,KAAK;GAC3B,gBAAgB,KAAK;EACtB,CAAC;EAED,KAAK,MAAM,cAAc,QAAQ,aAAa;GAC7C,MAAM,SACL,WAAW,SAAS,UACjB,YACA,WAAW,SAAS,YACnB,cACA;GACL,QAAQ,MAAM,GAAG,SAAS,WAAW,SAAS;EAC/C;EACA,IACC,QAAQ,YAAY,MAClB,eAAe,WAAW,SAAS,OACrC,GACC;GACD,MAAM,QAAQ,QAAQ;GACtB,QAAQ,KAAK,CAAC;EACf;EAEA,IAAI,iBAAiB,OACpB,MAAM,WAAW,OAAO;OAClB,IAAI,KAAK,SAAS,KAAK,QAAQ,QAAQ;GAC7C,IAAI,cAA+B;GACnC,IAAI,KAAK,MACR,cAAc;GAEf,MAAM,OAAO,MAAM,aAAa,SAAS;IACxC,MAAM;IACN,gBAAgB,UAAU;IAC1B,eAAe,CAAC;IAChB,UAAU,CAAC;GACZ,CAAC;GACD,QAAQ,KAAK,IAAI;EAClB,OAAO,IAAI,CAAC,QAAQ,OAAO,OAC1B,MAAM,YAAY,IAAI;OAEtB,MAAM,qBAAqB,SAAS,eAAe;CAErD;AACD,CAAC;AAEI,QAAQ,MAAM,EAClB,WAAW,OAAO,KAAK,WAAW;CACjC,MAAM,YAAY,KAAK,MAAM;AAC9B,EACD,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/cli-args.ts","../src/runtime-preflight.ts","../src/warnings.ts","../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport {\n\tBUILTIN_EXTENSIONS,\n\ttype BuiltinExtensionOptionName,\n} from './extensions/builtin-registry.js';\n\nconst THINKING_LEVELS = new Set([\n\t'off',\n\t'minimal',\n\t'low',\n\t'medium',\n\t'high',\n\t'xhigh',\n]);\n\nexport type CliThinkingLevel =\n\t| 'off'\n\t| 'minimal'\n\t| 'low'\n\t| 'medium'\n\t| 'high'\n\t| 'xhigh';\n\nexport type BuiltinDisableCliArgs = Record<\n\tstring,\n\t{\n\t\ttype: 'boolean';\n\t\tdescription: string;\n\t\tdefault: false;\n\t}\n>;\n\nexport interface CliArgDefinition {\n\ttype: 'boolean' | 'string' | 'enum' | 'positional';\n\talias?: string | readonly string[];\n}\n\nexport type CliArgDefinitions = Record<string, CliArgDefinition>;\n\nexport interface ParsedExtensionCliArgs {\n\textension_flag_values: Map<string, boolean | string>;\n\tpositionals: string[];\n\tdiagnostics: string[];\n}\n\nexport function create_builtin_disable_cli_args(): BuiltinDisableCliArgs {\n\treturn Object.fromEntries(\n\t\tBUILTIN_EXTENSIONS.map((extension) => [\n\t\t\textension.cli_arg,\n\t\t\t{\n\t\t\t\ttype: 'boolean' as const,\n\t\t\t\tdescription: extension.cli_description,\n\t\t\t\tdefault: false as const,\n\t\t\t},\n\t\t]),\n\t);\n}\n\nfunction is_citty_no_flag_set(\n\targs: Record<string, unknown>,\n\tcli_arg: string,\n): boolean {\n\tif (args[cli_arg]) return true;\n\n\tconst positive_kebab = cli_arg.replace(/^no-/, '');\n\tconst positive_camel = positive_kebab.replace(\n\t\t/-([a-z])/g,\n\t\t(_, char) => String(char).toUpperCase(),\n\t);\n\treturn (\n\t\targs[positive_kebab] === false || args[positive_camel] === false\n\t);\n}\n\nexport function resolve_builtin_extension_options(\n\targs: Record<string, unknown>,\n): Partial<Record<BuiltinExtensionOptionName, boolean>> {\n\tconst no_builtin = is_citty_no_flag_set(args, 'no-builtin');\n\treturn Object.fromEntries(\n\t\tBUILTIN_EXTENSIONS.map((extension) => [\n\t\t\textension.option_name,\n\t\t\t!no_builtin &&\n\t\t\t\t!is_citty_no_flag_set(args, extension.cli_arg) &&\n\t\t\t\textension.default_enabled,\n\t\t]),\n\t) as Partial<Record<BuiltinExtensionOptionName, boolean>>;\n}\n\nexport function parse_extension_cli_args(\n\targv: string[],\n\tknown_args: CliArgDefinitions,\n): ParsedExtensionCliArgs {\n\tconst known_flags = new Map<string, CliArgDefinition['type']>();\n\tfor (const [name, definition] of Object.entries(known_args)) {\n\t\tknown_flags.set(`--${name}`, definition.type);\n\t\tconst camel_name = name.replace(/-([a-z])/g, (_, char) =>\n\t\t\tString(char).toUpperCase(),\n\t\t);\n\t\tknown_flags.set(`--${camel_name}`, definition.type);\n\t\tif (definition.type === 'boolean')\n\t\t\tknown_flags.set(`--no-${name}`, definition.type);\n\t\tconst aliases = Array.isArray(definition.alias)\n\t\t\t? definition.alias\n\t\t\t: definition.alias\n\t\t\t\t? [definition.alias]\n\t\t\t\t: [];\n\t\tfor (const alias of aliases)\n\t\t\tknown_flags.set(`-${alias}`, definition.type);\n\t}\n\n\tconst extension_flag_values = new Map<string, boolean | string>();\n\tconst positionals: string[] = [];\n\tconst diagnostics: string[] = [];\n\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tconst arg = argv[i];\n\t\tif (!arg) continue;\n\t\tif (arg === '--') {\n\t\t\tpositionals.push(...argv.slice(i + 1));\n\t\t\tbreak;\n\t\t}\n\n\t\tconst equals_index = arg.indexOf('=');\n\t\tconst flag_token =\n\t\t\tequals_index === -1 ? arg : arg.slice(0, equals_index);\n\t\tconst known_type = known_flags.get(flag_token);\n\t\tif (known_type) {\n\t\t\tif (\n\t\t\t\tequals_index === -1 &&\n\t\t\t\t(known_type === 'string' || known_type === 'enum') &&\n\t\t\t\ti + 1 < argv.length &&\n\t\t\t\targv[i + 1] !== '--'\n\t\t\t) {\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg.startsWith('--')) {\n\t\t\tif (equals_index !== -1) {\n\t\t\t\textension_flag_values.set(\n\t\t\t\t\targ.slice(2, equals_index),\n\t\t\t\t\targ.slice(equals_index + 1),\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst name = arg.slice(2);\n\t\t\tconst next = argv[i + 1];\n\t\t\tif (\n\t\t\t\tnext !== undefined &&\n\t\t\t\t!next.startsWith('-') &&\n\t\t\t\t!next.startsWith('@')\n\t\t\t) {\n\t\t\t\textension_flag_values.set(name, next);\n\t\t\t\ti += 1;\n\t\t\t} else {\n\t\t\t\textension_flag_values.set(name, true);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arg.startsWith('-')) {\n\t\t\tdiagnostics.push(`Unknown option: ${arg}`);\n\t\t\tcontinue;\n\t\t}\n\t\tpositionals.push(arg);\n\t}\n\n\treturn { extension_flag_values, positionals, diagnostics };\n}\n\nexport function collect_flag_values(\n\targv: string[],\n\tflags: readonly string[],\n): string[] {\n\tconst values: string[] = [];\n\tconst flag_set = new Set(flags);\n\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tconst arg = argv[i];\n\t\tif (arg === '--') break;\n\t\tif (!arg) continue;\n\n\t\tconst equals_index = arg.indexOf('=');\n\t\tif (equals_index !== -1) {\n\t\t\tconst name = arg.slice(0, equals_index);\n\t\t\tif (flag_set.has(name)) {\n\t\t\t\tvalues.push(arg.slice(equals_index + 1));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (flag_set.has(arg) && i + 1 < argv.length) {\n\t\t\tconst next = argv[i + 1];\n\t\t\tif (next !== undefined && next !== '--') {\n\t\t\t\tvalues.push(next);\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn values;\n}\n\nexport function parse_extension_paths(\n\targv: string[],\n\tcwd = process.cwd(),\n): string[] {\n\treturn collect_flag_values(argv, ['-e', '--extension'])\n\t\t.map((path) => path.trim())\n\t\t.filter(Boolean)\n\t\t.map((path) => resolve(cwd, path));\n}\n\nfunction parse_comma_list_flags(\n\targv: string[],\n\tflags: readonly string[],\n): string[] | undefined {\n\tconst values = collect_flag_values(argv, flags)\n\t\t.flatMap((value) => value.split(','))\n\t\t.map((value) => value.trim())\n\t\t.filter(Boolean);\n\treturn values.length ? [...new Set(values)] : undefined;\n}\n\nexport function parse_tool_allowlist(\n\targv: string[],\n): string[] | undefined {\n\treturn parse_comma_list_flags(argv, ['--tools', '-t']);\n}\n\nexport function parse_tool_excludelist(\n\targv: string[],\n): string[] | undefined {\n\treturn parse_comma_list_flags(argv, ['--exclude-tools', '-xt']);\n}\n\nexport function parse_skill_allowlist(\n\targv: string[],\n): string[] | undefined {\n\treturn parse_comma_list_flags(argv, ['--skill']);\n}\n\nexport function parse_thinking_level(\n\tvalue: string | undefined,\n): CliThinkingLevel | undefined {\n\tconst normalized = value?.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\tif (!THINKING_LEVELS.has(normalized)) {\n\t\tthrow new Error(\n\t\t\t'--thinking must be one of: off, minimal, low, medium, high, xhigh.',\n\t\t);\n\t}\n\treturn normalized as CliThinkingLevel;\n}\n","export const MINIMUM_NODE_VERSION = '24.15.0';\n\nfunction parse_node_version(\n\tversion: string,\n): [number, number, number] | undefined {\n\tconst match = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:[-+].*)?$/.exec(version);\n\tif (!match) return undefined;\n\treturn [Number(match[1]), Number(match[2]), Number(match[3])];\n}\n\nexport function is_supported_node_version(version: string): boolean {\n\tconst current = parse_node_version(version);\n\tconst minimum = parse_node_version(MINIMUM_NODE_VERSION);\n\tif (!current || !minimum) return false;\n\n\tfor (let index = 0; index < current.length; index++) {\n\t\tif (current[index] > minimum[index]) return true;\n\t\tif (current[index] < minimum[index]) return false;\n\t}\n\treturn true;\n}\n\nexport function get_node_preflight_error(\n\tcurrent_version = process.versions.node,\n): string | undefined {\n\tif (is_supported_node_version(current_version)) return undefined;\n\treturn `my-pi requires Node >=${MINIMUM_NODE_VERSION}; current version is ${current_version}. Upgrade Node and retry.`;\n}\n","const SQLITE_EXPERIMENTAL_WARNING =\n\t'SQLite is an experimental feature';\nconst FILTER_INSTALLED = Symbol.for(\n\t'my-pi.sqlite-warning-filter-installed',\n);\nconst ORIGINAL_EMIT_WARNING = Symbol.for(\n\t'my-pi.original-emit-warning',\n);\n\ntype WarningEmitter = Pick<typeof process, 'emitWarning'> & {\n\t[FILTER_INSTALLED]?: boolean;\n\t[ORIGINAL_EMIT_WARNING]?: typeof process.emitWarning;\n};\n\nexport function should_suppress_warning(warning: Error): boolean {\n\treturn (\n\t\twarning.name === 'ExperimentalWarning' &&\n\t\twarning.message.includes(SQLITE_EXPERIMENTAL_WARNING)\n\t);\n}\n\nfunction should_suppress_emit_warning_args(args: unknown[]): boolean {\n\tconst [warning, options_or_type] = args;\n\tif (warning instanceof Error)\n\t\treturn should_suppress_warning(warning);\n\tconst warning_type =\n\t\ttypeof options_or_type === 'string'\n\t\t\t? options_or_type\n\t\t\t: options_or_type && typeof options_or_type === 'object'\n\t\t\t\t? (options_or_type as { type?: unknown }).type\n\t\t\t\t: undefined;\n\treturn (\n\t\twarning_type === 'ExperimentalWarning' &&\n\t\tString(warning).includes(SQLITE_EXPERIMENTAL_WARNING)\n\t);\n}\n\nexport function install_sqlite_warning_filter(\n\tprocess_like: WarningEmitter = process,\n): void {\n\tif (process_like[FILTER_INSTALLED]) return;\n\tprocess_like[FILTER_INSTALLED] = true;\n\n\tconst original_emit_warning =\n\t\tprocess_like[ORIGINAL_EMIT_WARNING] ?? process_like.emitWarning;\n\tprocess_like[ORIGINAL_EMIT_WARNING] = original_emit_warning;\n\n\tprocess_like.emitWarning = function emit_filtered_warning(\n\t\tthis: WarningEmitter,\n\t\t...args: unknown[]\n\t) {\n\t\tif (should_suppress_emit_warning_args(args)) return;\n\t\treturn (\n\t\t\toriginal_emit_warning as (...args: unknown[]) => void\n\t\t).apply(this, args);\n\t} as typeof process.emitWarning;\n}\n","#!/usr/bin/env node\n\nimport {\n\tdefineCommand,\n\trenderUsage,\n\trunMain,\n\ttype ArgsDef,\n\ttype CommandDef,\n} from 'citty';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport {\n\tcreate_builtin_disable_cli_args,\n\tparse_extension_cli_args,\n\tparse_extension_paths,\n\tparse_skill_allowlist,\n\tparse_thinking_level,\n\tparse_tool_allowlist,\n\tparse_tool_excludelist,\n\tresolve_builtin_extension_options,\n\ttype CliArgDefinitions,\n} from './cli-args.js';\nimport { get_node_preflight_error } from './runtime-preflight.js';\nimport { install_sqlite_warning_filter } from './warnings.js';\n\nconst node_preflight_error = get_node_preflight_error();\nif (node_preflight_error) {\n\tconsole.error(node_preflight_error);\n\tprocess.exit(1);\n}\n\ninstall_sqlite_warning_filter();\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst package_root = join(__dirname, '..');\nconst pkg = JSON.parse(\n\treadFileSync(join(package_root, 'package.json'), 'utf-8'),\n);\n\n// my-pi is a wrapper around Pi; upstream Pi update banners are useful in\n// this repo, but confusing for installed wrapper users.\nif (!existsSync(join(package_root, '.git'))) {\n\tprocess.env.PI_SKIP_VERSION_CHECK ??= '1';\n}\n\nasync function read_stdin(): Promise<string> {\n\tconst chunks: Buffer[] = [];\n\tfor await (const chunk of process.stdin) {\n\t\tchunks.push(chunk as Buffer);\n\t}\n\treturn Buffer.concat(chunks).toString('utf-8').trim();\n}\n\ntype MyPiRuntime = Awaited<\n\tReturnType<(typeof import('./api.js'))['create_my_pi']>\n>;\ntype InteractiveModeConstructor =\n\t(typeof import('@earendil-works/pi-coding-agent'))['InteractiveMode'];\n\nasync function run_interactive_mode(\n\truntime: MyPiRuntime,\n\tInteractiveModeClass: InteractiveModeConstructor,\n): Promise<void> {\n\tconst original_write = process.stdout.write.bind(process.stdout);\n\tprocess.stdout.write = ((\n\t\tchunk: string | Uint8Array,\n\t\t...args: Parameters<typeof original_write>\n\t) => {\n\t\tif (typeof chunk === 'string') {\n\t\t\tconst escape = String.fromCharCode(27);\n\t\t\tconst styled_hint = new RegExp(\n\t\t\t\t`(To resume this session:${escape}\\\\[[\\\\d;]*m )pi( --session )`,\n\t\t\t\t'g',\n\t\t\t);\n\t\t\tchunk = chunk.replace(styled_hint, '$1my-pi$2');\n\t\t\tchunk = chunk.replace(\n\t\t\t\t/(To resume this session: )pi( --session )/g,\n\t\t\t\t'$1my-pi$2',\n\t\t\t);\n\t\t}\n\t\treturn Reflect.apply(original_write, process.stdout, [\n\t\t\tchunk,\n\t\t\t...args,\n\t\t]);\n\t}) as typeof process.stdout.write;\n\ttry {\n\t\tconst mode = new InteractiveModeClass(runtime, {\n\t\t\tmigratedProviders: [],\n\t\t\tmodelFallbackMessage: undefined,\n\t\t\tinitialMessage: undefined,\n\t\t\tinitialImages: [],\n\t\t\tinitialMessages: [],\n\t\t});\n\t\tawait mode.run();\n\t} finally {\n\t\tprocess.stdout.write =\n\t\t\toriginal_write as typeof process.stdout.write;\n\t}\n}\n\nconst HELP_APPENDIX = `\nMODES\n\n my-pi\n Interactive TUI with slash commands, editor, and session UI.\n\n my-pi \"prompt\"\n my-pi -P \"prompt\"\n One-shot print mode with plain text output.\n\n my-pi --json \"prompt\"\n Non-interactive NDJSON mode for scripts, evals, and other agents.\n\n my-pi --mode rpc\n RPC mode over stdin/stdout JSONL for orchestrators and teammate sessions.\n\nNOTES\n\n - In non-interactive modes, my-pi keeps headless-capable built-ins like\n MCP, LSP, prompt presets, recall, nopeek, Omnisearch, SQLite tools, hooks, and secret redaction.\n - UI-only built-ins like session auto-naming are skipped.\n - Repeat -e / --extension to compose multiple extensions.\n - Positional prompt arguments are joined with a single space.\n - Everything after -- is prompt text, not options.\n - --prompt takes precedence over positional prompt text and stdin.\n\nNESTED RUNS\n\n - Child runs inherit cwd and environment unless you isolate them explicitly.\n - Use --agent-dir to isolate auth, config, sessions, and telemetry state.\n - For safer evals or unknown repos, use --untrusted plus an explicit\n --system-prompt.\n\nEXAMPLES\n\n my-pi\n my-pi \"fix the failing test\"\n my-pi -P \"summarize this repo\"\n my-pi --json \"list all TODO comments\"\n echo \"plan a login page\" | my-pi --json\n my-pi --telemetry --json \"run eval case\"\n my-pi --telemetry --telemetry-db ./tmp/evals.db --json \"run case\"\n my-pi observability\n my-pi --untrusted --agent-dir /tmp/pi-agent --json \"run case\"\n my-pi -e ./my-ext.ts -e ./other-ext.ts \"hello\"\n my-pi -m claude-haiku-4-5-20241022 \"explain this file\"\n XIAOMI_API_KEY=... my-pi -m xiaomi/mimo-v2.5-pro \"summarize this repo\"\n my-pi -m cloudflare-workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast \"explain this file\"\n my-pi --preset terse,no-purple-prose \"summarize this repo\"\n my-pi --system-prompt \"You are a JSON classifier. Return only JSON.\" --json \"classify this\"\n\nPROMPT PRESETS\n\n Interactive commands:\n /prompt-preset help\n /prompt-preset export-defaults\n /prompt-preset edit-global terse\n /prompt-preset base detailed\n /prompt-preset enable bullets\n\n Short alias: /preset\n\n Editable preset files:\n ~/.pi/agent/presets/*.md\n .pi/presets/*.md\n`;\n\nasync function render_rich_usage<T extends ArgsDef>(\n\tcmd: CommandDef<T>,\n\tparent?: CommandDef<T>,\n): Promise<string> {\n\treturn `${await renderUsage(cmd, parent)}\\n${HELP_APPENDIX}`;\n}\n\nasync function print_usage<T extends ArgsDef>(\n\tcmd: CommandDef<T>,\n\tparent?: CommandDef<T>,\n): Promise<void> {\n\tconsole.log(await render_rich_usage(cmd, parent));\n}\n\nconst main = defineCommand({\n\tmeta: {\n\t\tname: 'my-pi',\n\t\tversion: pkg.version,\n\t\tdescription:\n\t\t\t'Composable pi coding agent with MCP, LSP, presets, and local eval telemetry',\n\t},\n\targs: {\n\t\tprint: {\n\t\t\ttype: 'boolean',\n\t\t\talias: 'P',\n\t\t\tdescription: 'Print mode (non-interactive, one-shot)',\n\t\t\tdefault: false,\n\t\t},\n\t\t'agent-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override Pi auth/config/session directory for this process',\n\t\t\trequired: false,\n\t\t},\n\t\t'session-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override Pi session storage directory for this process',\n\t\t\trequired: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\talias: 'j',\n\t\t\tdescription: 'Output NDJSON events (for agent consumption)',\n\t\t\tdefault: false,\n\t\t},\n\t\tmode: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Runtime mode: interactive, print, json, or rpc',\n\t\t\trequired: false,\n\t\t},\n\t\textension: {\n\t\t\ttype: 'string',\n\t\t\talias: 'e',\n\t\t\tdescription:\n\t\t\t\t'Extension path to load; repeatable via argv parsing',\n\t\t\trequired: false,\n\t\t},\n\t\t'no-builtin': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Disable all built-in extensions',\n\t\t\tdefault: false,\n\t\t},\n\t\tuntrusted: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription:\n\t\t\t\t'Safe mode for unknown repos: skip project MCP, hooks, project prompt presets, project skills, and project LSP binaries unless explicitly re-enabled',\n\t\t\tdefault: false,\n\t\t},\n\t\t...create_builtin_disable_cli_args(),\n\t\ttelemetry: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Enable local SQLite telemetry for this process',\n\t\t\tdefault: false,\n\t\t},\n\t\t'no-telemetry': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Disable local SQLite telemetry for this process',\n\t\t\tdefault: false,\n\t\t},\n\t\t'telemetry-db': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override telemetry database path for this process',\n\t\t\trequired: false,\n\t\t},\n\t\tmodel: {\n\t\t\ttype: 'string',\n\t\t\talias: 'm',\n\t\t\tdescription:\n\t\t\t\t'Model to use (e.g. claude-sonnet-4-5-20241022, gpt-5.4, cloudflare-workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast)',\n\t\t},\n\t\tthinking: {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Thinking level: off, minimal, low, medium, high, or xhigh',\n\t\t\trequired: false,\n\t\t},\n\t\ttools: {\n\t\t\ttype: 'string',\n\t\t\talias: 't',\n\t\t\tdescription:\n\t\t\t\t'Comma-separated allowlist of tool names to enable',\n\t\t\trequired: false,\n\t\t},\n\t\t'exclude-tools': {\n\t\t\ttype: 'string',\n\t\t\talias: 'xt',\n\t\t\tdescription: 'Comma-separated list of tool names to disable',\n\t\t\trequired: false,\n\t\t},\n\t\tsession: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Resume a specific session file or session ID',\n\t\t\trequired: false,\n\t\t},\n\t\t'session-id': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Create or resume an exact project-local session ID',\n\t\t\trequired: false,\n\t\t},\n\t\tname: {\n\t\t\ttype: 'string',\n\t\t\talias: 'n',\n\t\t\tdescription: 'Set the session display name at startup',\n\t\t\trequired: false,\n\t\t},\n\t\tskill: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Skill name to allow; repeatable in argv parsing',\n\t\t\trequired: false,\n\t\t},\n\t\t'system-prompt': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Replace the base system prompt',\n\t\t\trequired: false,\n\t\t},\n\t\t'append-system-prompt': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Append one-off instructions to the system prompt',\n\t\t\trequired: false,\n\t\t},\n\t\tprompt: {\n\t\t\ttype: 'string',\n\t\t\talias: 'p',\n\t\t\tdescription: 'Prompt text (alternative to positional argument)',\n\t\t\trequired: false,\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst cwd = process.cwd();\n\t\tconst cli_argv = process.argv.slice(2);\n\t\tconst parsed_extension_cli = parse_extension_cli_args(\n\t\t\tcli_argv,\n\t\t\tmain.args as CliArgDefinitions,\n\t\t);\n\t\tif (parsed_extension_cli.diagnostics.length) {\n\t\t\tfor (const message of parsed_extension_cli.diagnostics)\n\t\t\t\tconsole.error(`Error: ${message}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tconst extension_paths = parse_extension_paths(cli_argv, cwd);\n\t\tconst selected_tools = parse_tool_allowlist(cli_argv);\n\t\tconst excluded_tools = parse_tool_excludelist(cli_argv);\n\t\tconst selected_skills = parse_skill_allowlist(cli_argv);\n\t\tlet selected_thinking;\n\t\ttry {\n\t\t\tselected_thinking = parse_thinking_level(args.thinking);\n\t\t} catch (error) {\n\t\t\tconsole.error(\n\t\t\t\terror instanceof Error ? error.message : String(error),\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tlet runtime_mode: 'interactive' | 'print' | 'json' | 'rpc' =\n\t\t\t'interactive';\n\t\tif (args.mode) {\n\t\t\tconst requested = String(args.mode).trim().toLowerCase();\n\t\t\tif (\n\t\t\t\t!['interactive', 'print', 'json', 'rpc'].includes(requested)\n\t\t\t) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Error: --mode must be one of interactive, print, json, rpc.',\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\truntime_mode = requested as\n\t\t\t\t| 'interactive'\n\t\t\t\t| 'print'\n\t\t\t\t| 'json'\n\t\t\t\t| 'rpc';\n\t\t}\n\t\tif (args.json) runtime_mode = 'json';\n\t\telse if (args.print) runtime_mode = 'print';\n\n\t\tconst positionals = parsed_extension_cli.positionals;\n\t\tif (positionals?.[0] === 'observability') {\n\t\t\tconst { start_observability_server } =\n\t\t\t\tawait import('@spences10/pi-observability/server');\n\t\t\tstart_observability_server();\n\t\t\treturn;\n\t\t}\n\n\t\t// Resolve prompt: named --prompt flag > positional > stdin\n\t\tlet prompt = args.prompt;\n\t\tif (!prompt && positionals && positionals.length > 0) {\n\t\t\tprompt = positionals.join(' ');\n\t\t}\n\t\tif (!prompt && !process.stdin.isTTY && runtime_mode !== 'rpc') {\n\t\t\tprompt = await read_stdin();\n\t\t}\n\t\tif (prompt && runtime_mode === 'interactive')\n\t\t\truntime_mode = 'print';\n\n\t\tif (\n\t\t\truntime_mode === 'interactive' &&\n\t\t\t!prompt &&\n\t\t\t!process.stdout.isTTY\n\t\t) {\n\t\t\tawait print_usage(main);\n\t\t\treturn;\n\t\t}\n\n\t\t// Startup feedback so silence = broken (issue #3)\n\t\tif (runtime_mode !== 'interactive') {\n\t\t\tprocess.stderr.write(\n\t\t\t\t`my-pi: connecting to ${args.model || 'default model'}...\\n`,\n\t\t\t);\n\t\t}\n\n\t\tif (args.telemetry && args['no-telemetry']) {\n\t\t\tconsole.error(\n\t\t\t\t'Error: --telemetry and --no-telemetry cannot be used together.',\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tif (args.session && args['session-id']) {\n\t\t\tconsole.error(\n\t\t\t\t'Error: --session and --session-id cannot be used together.',\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tlet telemetry_override: boolean | undefined;\n\t\tif (args.telemetry) {\n\t\t\ttelemetry_override = true;\n\t\t} else if (args['no-telemetry']) {\n\t\t\ttelemetry_override = false;\n\t\t}\n\n\t\tconst [\n\t\t\t{ create_my_pi },\n\t\t\t{ InteractiveMode, runPrintMode, runRpcMode },\n\t\t] = await Promise.all([\n\t\t\timport('./api.js'),\n\t\t\timport('@earendil-works/pi-coding-agent'),\n\t\t]);\n\n\t\tconst runtime = await create_my_pi({\n\t\t\tcwd,\n\t\t\tagent_dir: args['agent-dir'],\n\t\t\tsession_dir: args['session-dir'],\n\t\t\textensions: extension_paths,\n\t\t\textension_flag_values:\n\t\t\t\tparsed_extension_cli.extension_flag_values,\n\t\t\truntime_mode,\n\t\t\t...resolve_builtin_extension_options(args),\n\t\t\ttelemetry: telemetry_override,\n\t\t\ttelemetry_db_path: args['telemetry-db'],\n\t\t\tmodel: args.model,\n\t\t\tthinking: selected_thinking,\n\t\t\tselected_tools,\n\t\t\texcluded_tools,\n\t\t\tselected_skills,\n\t\t\tsession: args.session,\n\t\t\tsession_id: args['session-id'],\n\t\t\tstartup_session_name: args.name,\n\t\t\tsystem_prompt: args['system-prompt'],\n\t\t\tappend_system_prompt: args['append-system-prompt'],\n\t\t\tuntrusted_repo: args.untrusted,\n\t\t});\n\n\t\tfor (const diagnostic of runtime.diagnostics) {\n\t\t\tconst prefix =\n\t\t\t\tdiagnostic.type === 'error'\n\t\t\t\t\t? 'Error: '\n\t\t\t\t\t: diagnostic.type === 'warning'\n\t\t\t\t\t\t? 'Warning: '\n\t\t\t\t\t\t: '';\n\t\t\tconsole.error(`${prefix}${diagnostic.message}`);\n\t\t}\n\t\tif (\n\t\t\truntime.diagnostics.some(\n\t\t\t\t(diagnostic) => diagnostic.type === 'error',\n\t\t\t)\n\t\t) {\n\t\t\tawait runtime.dispose();\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tif (runtime_mode === 'rpc') {\n\t\t\tawait runRpcMode(runtime);\n\t\t} else if (runtime_mode === 'print' || runtime_mode === 'json') {\n\t\t\tconst code = await runPrintMode(runtime, {\n\t\t\t\tmode: runtime_mode === 'json' ? 'json' : 'text',\n\t\t\t\tinitialMessage: prompt || '',\n\t\t\t\tinitialImages: [],\n\t\t\t\tmessages: [],\n\t\t\t});\n\t\t\tprocess.exit(code);\n\t\t} else if (!process.stdout.isTTY) {\n\t\t\tawait print_usage(main);\n\t\t} else {\n\t\t\tawait run_interactive_mode(runtime, InteractiveMode);\n\t\t}\n\t},\n});\n\nvoid runMain(main, {\n\tshowUsage: async (cmd, parent) => {\n\t\tawait print_usage(cmd, parent);\n\t},\n});\n"],"mappings":";;;;;;;AAMA,MAAM,kCAAkB,IAAI,IAAI;CAC/B;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAgCD,SAAgB,kCAAyD;CACxE,OAAO,OAAO,YACb,mBAAmB,KAAK,cAAc,CACrC,UAAU,SACV;EACC,MAAM;EACN,aAAa,UAAU;EACvB,SAAS;CACV,CACD,CAAC,CACF;AACD;AAEA,SAAS,qBACR,MACA,SACU;CACV,IAAI,KAAK,UAAU,OA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEtB,eAAe,kBACd,KACA,QACkB;CAClB,OAAO,GAAG,MAAM,YAAY,KAAK,MAAM,EAAE,IAAI;AAC9C;AAEA,eAAe,YACd,KACA,QACgB;CAChB,QAAQ,IAAI,MAAM,kBAAkB,KAAK,MAAM,CAAC;AACjD;AAEA,MAAM,OAAO,cAAc;CAC1B,MAAM;EACL,MAAM;EACN,SAAS,IAAI;EACb,aACC;CACF;CACA,MAAM;EACL,OAAO;GACN,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS;EACV;EACA,aAAa;GACZ,MAAM;GACN,aACC;GACD,UAAU;EACX;EACA,eAAe;GACd,MAAM;GACN,aACC;GACD,UAAU;EACX;EACA,MAAM;GACL,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS;EACV;EACA,MAAM;GACL,MAAM;GACN,aAAa;GACb,UAAU;EACX;EACA,WAAW;GACV,MAAM;GACN,OAAO;GACP,aACC;GACD,UAAU;EACX;EACA,cAAc;GACb,MAAM;GACN,aAAa;GACb,SAAS;EACV;EACA,WAAW;GACV,MAAM;GACN,aACC;GACD,SAAS;EACV;EACA,GAAG,gCAAgC;EACnC,WAAW;GACV,MAAM;GACN,aAAa;GACb,SAAS;EACV;EACA,gBAAgB;GACf,MAAM;GACN,aAAa;GACb,SAAS;EACV;EACA,gBAAgB;GACf,MAAM;GACN,aACC;GACD,UAAU;EACX;EACA,OAAO;GACN,MAAM;GACN,OAAO;GACP,aACC;EACF;EACA,UAAU;GACT,MAAM;GACN,aACC;GACD,UAAU;EACX;EACA,OAAO;GACN,MAAM;GACN,OAAO;GACP,aACC;GACD,UAAU;EACX;EACA,iBAAiB;GAChB,MAAM;GACN,OAAO;GACP,aAAa;GACb,UAAU;EACX;EACA,SAAS;GACR,MAAM;GACN,aAAa;GACb,UAAU;EACX;EACA,cAAc;GACb,MAAM;GACN,aACC;GACD,UAAU;EACX;EACA,MAAM;GACL,M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jB,YACA,WAAW,SAAS,YACnB,cACA;GACL,QAAQ,MAAM,GAAG,SAAS,WAAW,SAAS;EAC/C;EACA,IACC,QAAQ,YAAY,MAClB,eAAe,WAAW,SAAS,OACrC,GACC;GACD,MAAM,QAAQ,QAAQ;GACtB,QAAQ,KAAK,CAAC;EACf;EAEA,IAAI,iBAAiB,OACpB,MAAM,WAAW,OAAO;OAClB,IAAI,iBAAiB,WAAW,iBAAiB,QAAQ;GAC/D,MAAM,OAAO,MAAM,aAAa,SAAS;IACxC,MAAM,iBAAiB,SAAS,SAAS;IACzC,gBAAgB,UAAU;IAC1B,eAAe,CAAC;IAChB,UAAU,CAAC;GACZ,CAAC;GACD,QAAQ,KAAK,IAAI;EAClB,OAAO,IAAI,CAAC,QAAQ,OAAO,OAC1B,MAAM,YAAY,IAAI;OAEtB,MAAM,qBAAqB,SAAS,eAAe;CAErD;AACD,CAAC;AAEI,QAAQ,MAAM,EAClB,WAAW,OAAO,KAAK,WAAW;CACjC,MAAM,YAAY,KAAK,MAAM;AAC9B,EACD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-pi",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Composable pi coding agent with MCP, LSP, prompt presets, and local eval telemetry",
5
5
  "keywords": [
6
6
  "cli",
@@ -43,9 +43,9 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@earendil-works/pi-ai": "0.85.1",
47
- "@earendil-works/pi-coding-agent": "0.85.1",
48
- "@earendil-works/pi-tui": "0.85.1",
46
+ "@earendil-works/pi-ai": "1.0.0",
47
+ "@earendil-works/pi-coding-agent": "1.0.0",
48
+ "@earendil-works/pi-tui": "1.0.0",
49
49
  "@spences10/pi-project-trust": "0.0.19",
50
50
  "@spences10/pi-settings": "0.0.3",
51
51
  "@spences10/pi-themes": "0.0.10",
@@ -56,10 +56,10 @@
56
56
  "@changesets/cli": "^3.0.0",
57
57
  "@resvg/resvg-js": "^2.6.2",
58
58
  "@types/node": "^25.8.0",
59
- "@vitest/coverage-v8": "4.1.11",
60
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.3",
61
- "vite-plus": "0.3.3",
62
- "vitest": "4.1.11"
59
+ "@vitest/coverage-v8": "5.0.1",
60
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
61
+ "vite-plus": "1.0.0",
62
+ "vitest": "5.0.1"
63
63
  },
64
64
  "optionalDependencies": {
65
65
  "@spences10/pi-child-env": "0.1.10",
@@ -72,7 +72,7 @@
72
72
  "@spences10/pi-git-ui": "0.0.16",
73
73
  "@spences10/pi-harness": "0.1.1",
74
74
  "@spences10/pi-kimi-usage": "0.0.2",
75
- "@spences10/pi-lsp": "0.0.47",
75
+ "@spences10/pi-lsp": "0.0.48",
76
76
  "@spences10/pi-mcp": "0.0.60",
77
77
  "@spences10/pi-nopeek": "0.0.16",
78
78
  "@spences10/pi-observability": "0.0.23",
@@ -107,6 +107,7 @@
107
107
  "eval:local": "node scripts/run-eval-case.ts",
108
108
  "eval:suite": "node scripts/run-eval-suite.ts",
109
109
  "preview:generate": "node scripts/generate-startup-preview.ts",
110
+ "web:share-card": "node scripts/generate-web-share-card.ts",
110
111
  "changeset": "changeset",
111
112
  "version": "changeset version && pnpm run preview:generate",
112
113
  "release": "git diff --quiet && git diff --cached --quiet && pnpm run build && changeset publish",