@testchimp/cli 0.1.20 → 0.1.21

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.
@@ -976,6 +976,28 @@ export function buildCliProgram() {
976
976
  console.log(await runTool(kebab, merged, { postMcp }));
977
977
  });
978
978
  }
979
+ program
980
+ .command("upsert-policy")
981
+ .description(TOOL_DEFINITIONS.find((t) => t.kebab === "upsert-policy").description)
982
+ .addOption(jsonInputOption())
983
+ .option("--policy-file-name <name>", "e.g. connect-to-test-env.policy.md")
984
+ .option("--content <markdown>", "full markdown including frontmatter")
985
+ .option("--content-file <path>", "read markdown from file")
986
+ .action(async (opts) => {
987
+ let content = opts.content;
988
+ if (opts.contentFile)
989
+ content = await readFile(String(opts.contentFile), "utf8");
990
+ const body = {};
991
+ if (opts.policyFileName)
992
+ body.policyFileName = String(opts.policyFileName);
993
+ if (content)
994
+ body.content = content;
995
+ const merged = mergeBodies(body, opts.jsonInput);
996
+ if (!merged.policyFileName || !merged.content) {
997
+ throw new Error("Provide --policy-file-name and --content or --content-file (or full body via --json-input)");
998
+ }
999
+ console.log(await runTool("upsert-policy", merged, { postMcp }));
1000
+ });
979
1001
  program.on("--help", () => {
980
1002
  /* default */
981
1003
  });
@@ -1097,4 +1097,8 @@ export declare const getPolicyInput: z.ZodObject<{
1097
1097
  export declare const listPoliciesInput: z.ZodObject<{
1098
1098
  workflowId: z.ZodOptional<z.ZodString>;
1099
1099
  }, z.core.$strip>;
1100
+ export declare const upsertPolicyInput: z.ZodObject<{
1101
+ policyFileName: z.ZodString;
1102
+ content: z.ZodString;
1103
+ }, z.core.$strip>;
1100
1104
  export declare const listWorkflowCatalogInput: z.ZodObject<{}, z.core.$strip>;
@@ -564,4 +564,8 @@ export const getPolicyInput = z.object({
564
564
  export const listPoliciesInput = z.object({
565
565
  workflowId: z.string().optional(),
566
566
  });
567
+ export const upsertPolicyInput = z.object({
568
+ policyFileName: z.string().min(1),
569
+ content: z.string().min(1),
570
+ });
567
571
  export const listWorkflowCatalogInput = z.object({});
@@ -873,7 +873,7 @@ export const TOOL_DEFINITIONS = [
873
873
  },
874
874
  {
875
875
  kebab: "get-policy",
876
- description: "Fetch a workflow policy file by name (e.g. run-qa.policy.md) from the platform POLICY_FILE store.",
876
+ description: "Fetch a workflow policy file by name (e.g. run-qa.policy.md) from the platform POLICY_FILE store. Filename is coerced to *.policy.md (same as upsert-policy).",
877
877
  inputSchema: S.getPolicyInput,
878
878
  execute: async (args, { postMcp }) => {
879
879
  const a = args;
@@ -892,6 +892,18 @@ export const TOOL_DEFINITIONS = [
892
892
  return postMcp("/api/mcp/list_policies", body);
893
893
  },
894
894
  },
895
+ {
896
+ kebab: "upsert-policy",
897
+ description: "Create or update a workflow policy file on the platform (plans/knowledge/policies/*.policy.md). policyFileName is coerced to *.policy.md (same as get-policy). Prefer after writing the file locally so the policy is available immediately (git sync also works later).",
898
+ inputSchema: S.upsertPolicyInput,
899
+ execute: async (args, { postMcp }) => {
900
+ const a = args;
901
+ return postMcp("/api/mcp/upsert_policy", {
902
+ policyFileName: a.policyFileName,
903
+ content: a.content,
904
+ });
905
+ },
906
+ },
895
907
  {
896
908
  kebab: "list-workflow-catalog",
897
909
  description: "List supported TestChimp workflows with Active / Disabled / Missing Config status for the project.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testchimp/cli",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "TestChimp CLI and MCP server — coverage, plans, EaaS, TrueCoverage (calls /api/mcp/*)",
5
5
  "type": "module",
6
6
  "main": "dist/bin/testchimp.js",