markform 0.1.16 → 0.1.17

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/dist/bin.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
 
4
- import { t as runCli } from "./cli-BsFessUW.mjs";
4
+ import { t as runCli } from "./cli-DAl8LQzI.mjs";
5
5
  import { resolve } from "node:path";
6
6
  import { existsSync } from "node:fs";
7
7
  import { config } from "dotenv";
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { L as PatchSchema } from "./coreTypes-DiCddBKu.mjs";
3
- import { A as MAX_FORMS_IN_MENU, B as formatSuggestedLlms, C as DEFAULT_MAX_TURNS, D as DEFAULT_RESEARCH_MAX_PATCHES_PER_TURN, E as DEFAULT_RESEARCH_MAX_ISSUES_PER_TURN, F as deriveSchemaPath, H as hasWebSearchSupport, I as detectFileType, L as parseRolesFlag, M as USER_ROLE, N as deriveExportPath, P as deriveReportPath, R as SUGGESTED_LLMS, U as parseModelIdForDisplay, _ as validateSyntaxConsistency, b as DEFAULT_MAX_ISSUES_PER_TURN, d as serializeForm, f as serializeRawMarkdown, i as inspect, j as REPORT_EXTENSION, m as friendlyUrlAbbrev, n as getAllFields, p as serializeReport, t as applyPatches, v as AGENT_ROLE, w as DEFAULT_PORT, x as DEFAULT_MAX_PATCHES_PER_TURN, y as DEFAULT_FORMS_DIR, z as WEB_SEARCH_CONFIG } from "./apply-CXsI5N9x.mjs";
4
- import { D as parseForm, E as formToJsonSchema, a as resolveHarnessConfig, c as getProviderNames, d as createLiveAgent, h as createHarness, i as runResearch, l as resolveModel, n as isResearchForm, o as fillForm, p as createMockAgent, s as getProviderInfo, t as VERSION, u as buildMockWireFormat } from "./src-Dv3IZSQU.mjs";
3
+ import { A as MAX_FORMS_IN_MENU, B as formatSuggestedLlms, C as DEFAULT_MAX_TURNS, D as DEFAULT_RESEARCH_MAX_PATCHES_PER_TURN, E as DEFAULT_RESEARCH_MAX_ISSUES_PER_TURN, F as deriveSchemaPath, H as hasWebSearchSupport, I as detectFileType, L as parseRolesFlag, M as USER_ROLE, N as deriveExportPath, P as deriveReportPath, R as SUGGESTED_LLMS, U as parseModelIdForDisplay, _ as validateSyntaxConsistency, b as DEFAULT_MAX_ISSUES_PER_TURN, d as serializeForm, f as serializeRawMarkdown, i as inspect, j as REPORT_EXTENSION, m as friendlyUrlAbbrev, n as getAllFields, p as serializeReport, t as applyPatches, v as AGENT_ROLE, w as DEFAULT_PORT, x as DEFAULT_MAX_PATCHES_PER_TURN, y as DEFAULT_FORMS_DIR, z as WEB_SEARCH_CONFIG } from "./apply-DgDJBscb.mjs";
4
+ import { D as parseForm, E as formToJsonSchema, a as resolveHarnessConfig, c as getProviderNames, d as createLiveAgent, h as createHarness, i as runResearch, l as resolveModel, n as isResearchForm, o as fillForm, p as createMockAgent, s as getProviderInfo, t as VERSION, u as buildMockWireFormat } from "./src-CHVJLGKt.mjs";
5
5
  import { n as serializeSession } from "./session-XDrocA3j.mjs";
6
6
  import { _ as writeFile, a as formatPath, c as logError, d as logTiming, f as logVerbose, g as stripHtmlComments, h as shouldUseColors, i as formatOutput, l as logInfo, m as readFile$1, n as createSpinner, o as getCommandContext, p as logWarn, r as ensureFormsDir, s as logDryRun, t as OUTPUT_FORMATS, u as logSuccess } from "./shared-CCq4haEV.mjs";
7
7
  import Markdoc from "@markdoc/markdoc";
@@ -227,7 +227,7 @@ function formatConsoleReport$3(report, useColors) {
227
227
  * Register the apply command.
228
228
  */
229
229
  function registerApplyCommand(program) {
230
- program.command("apply <file>").description("Apply patches to a form").option("--patch <json>", "JSON array of patches to apply").option("-o, --output <file>", "Output file (defaults to stdout)").option("--report", "Output apply result report instead of modified form").action(async (file, options, cmd) => {
230
+ program.command("apply <file>").description("Apply patches to a form").option("--patch <json>", "JSON array of patches to apply").option("-o, --output <file>", "Output file (defaults to stdout)").option("--report", "Output apply result report instead of modified form").option("--normalize", "Regenerate form without preserving external content").action(async (file, options, cmd) => {
231
231
  const ctx = getCommandContext(cmd);
232
232
  try {
233
233
  if (!options.patch) {
@@ -293,7 +293,7 @@ function registerApplyCommand(program) {
293
293
  logSuccess(ctx, `Report written to ${options.output}`);
294
294
  } else console.log(output);
295
295
  } else {
296
- const output = serializeForm(form);
296
+ const output = serializeForm(form, { preserveContent: !options.normalize });
297
297
  if (options.output) {
298
298
  await writeFile(options.output, output);
299
299
  logSuccess(ctx, `Modified form written to ${options.output}`);
@@ -2637,7 +2637,7 @@ function registerExamplesCommand(program) {
2637
2637
  * Register the export command.
2638
2638
  */
2639
2639
  function registerExportCommand(program) {
2640
- program.command("export <file>").description("Export form as markform (default), markdown (readable), or json/yaml for structured data").option("--compact", "Output compact JSON (no formatting, only for JSON format)").action(async (file, options, cmd) => {
2640
+ program.command("export <file>").description("Export form as markform (default), markdown (readable), or json/yaml for structured data").option("--compact", "Output compact JSON (no formatting, only for JSON format)").option("--normalize", "Regenerate form without preserving external content").action(async (file, options, cmd) => {
2641
2641
  const ctx = getCommandContext(cmd);
2642
2642
  let format = "markform";
2643
2643
  if (ctx.format === "json") format = "json";
@@ -2650,7 +2650,7 @@ function registerExportCommand(program) {
2650
2650
  logVerbose(ctx, "Parsing form...");
2651
2651
  const form = parseForm(content);
2652
2652
  if (format === "markform") {
2653
- console.log(serializeForm(form));
2653
+ console.log(serializeForm(form, { preserveContent: !options.normalize }));
2654
2654
  return;
2655
2655
  }
2656
2656
  if (format === "markdown") {
@@ -2683,7 +2683,7 @@ function registerExportCommand(program) {
2683
2683
  schema,
2684
2684
  values,
2685
2685
  notes: form.notes,
2686
- markdown: serializeForm(form)
2686
+ markdown: serializeForm(form, { preserveContent: !options.normalize })
2687
2687
  };
2688
2688
  if (format === "json") if (options.compact) console.log(JSON.stringify(output));
2689
2689
  else console.log(JSON.stringify(output, null, 2));
@@ -2768,7 +2768,7 @@ function formatConsoleSession(transcript, useColors) {
2768
2768
  * Register the fill command.
2769
2769
  */
2770
2770
  function registerFillCommand(program) {
2771
- program.command("fill <file>").description("Run an agent to autonomously fill a form").option("--mock", "Use mock agent (requires --mock-source)").option("--model <id>", "Model ID for live agent (format: provider/model-id, e.g. openai/gpt-5-mini)").option("--mock-source <file>", "Path to completed form for mock agent").option("--record <file>", "Record session transcript to file").option("--max-turns <n>", `Maximum turns (default: ${DEFAULT_MAX_TURNS})`, String(DEFAULT_MAX_TURNS)).option("--max-patches <n>", `Maximum patches per turn (default: ${DEFAULT_MAX_PATCHES_PER_TURN})`, String(DEFAULT_MAX_PATCHES_PER_TURN)).option("--max-issues <n>", `Maximum issues shown per turn (default: ${DEFAULT_MAX_ISSUES_PER_TURN})`, String(DEFAULT_MAX_ISSUES_PER_TURN)).option("--max-fields <n>", "Maximum unique fields per turn (applied before --max-issues)").option("--max-groups <n>", "Maximum unique groups per turn (applied before --max-issues)").option("--roles <roles>", "Target roles to fill (comma-separated, or '*' for all; default: 'agent', or 'user' in --interactive mode)").option("--mode <mode>", "Fill mode: continue (skip filled fields) or overwrite (re-fill; default: continue)").option("-o, --output <file>", "Write final form to file").option("--prompt <file>", "Path to custom system prompt file (appends to default)").option("--instructions <text>", "Inline system prompt (appends to default; takes precedence over --prompt)").option("-i, --interactive", "Interactive mode: prompt user for field values (defaults to user role)").action(async (file, options, cmd) => {
2771
+ program.command("fill <file>").description("Run an agent to autonomously fill a form").option("--mock", "Use mock agent (requires --mock-source)").option("--model <id>", "Model ID for live agent (format: provider/model-id, e.g. openai/gpt-5-mini)").option("--mock-source <file>", "Path to completed form for mock agent").option("--record <file>", "Record session transcript to file").option("--max-turns <n>", `Maximum turns (default: ${DEFAULT_MAX_TURNS})`, String(DEFAULT_MAX_TURNS)).option("--max-patches <n>", `Maximum patches per turn (default: ${DEFAULT_MAX_PATCHES_PER_TURN})`, String(DEFAULT_MAX_PATCHES_PER_TURN)).option("--max-issues <n>", `Maximum issues shown per turn (default: ${DEFAULT_MAX_ISSUES_PER_TURN})`, String(DEFAULT_MAX_ISSUES_PER_TURN)).option("--max-fields <n>", "Maximum unique fields per turn (applied before --max-issues)").option("--max-groups <n>", "Maximum unique groups per turn (applied before --max-issues)").option("--roles <roles>", "Target roles to fill (comma-separated, or '*' for all; default: 'agent', or 'user' in --interactive mode)").option("--mode <mode>", "Fill mode: continue (skip filled fields) or overwrite (re-fill; default: continue)").option("-o, --output <file>", "Write final form to file").option("--prompt <file>", "Path to custom system prompt file (appends to default)").option("--instructions <text>", "Inline system prompt (appends to default; takes precedence over --prompt)").option("-i, --interactive", "Interactive mode: prompt user for field values (defaults to user role)").option("--normalize", "Regenerate form without preserving external content").action(async (file, options, cmd) => {
2772
2772
  const ctx = getCommandContext(cmd);
2773
2773
  const filePath = resolve(file);
2774
2774
  try {
@@ -3006,7 +3006,7 @@ function registerFillCommand(program) {
3006
3006
  await ensureFormsDir(formsDir);
3007
3007
  outputPath = generateVersionedPathInFormsDir(filePath, formsDir);
3008
3008
  }
3009
- const formMarkdown = serializeForm(harness.getForm());
3009
+ const formMarkdown = serializeForm(harness.getForm(), { preserveContent: !options.normalize });
3010
3010
  if (ctx.dryRun) logInfo(ctx, `[DRY RUN] Would write form to: ${outputPath}`);
3011
3011
  else {
3012
3012
  await writeFile(outputPath, formMarkdown);
@@ -6072,4 +6072,4 @@ async function runCli() {
6072
6072
 
6073
6073
  //#endregion
6074
6074
  export { runCli as t };
6075
- //# sourceMappingURL=cli-BsFessUW.mjs.map
6075
+ //# sourceMappingURL=cli-DAl8LQzI.mjs.map