@codapult/guard 0.7.0 → 0.8.1

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.
@@ -4,6 +4,7 @@ import { guardErrorPayload } from '../../core/errors.js';
4
4
  import { analyzeProjectImpact } from '../../core/analysis/impact.js';
5
5
  import { z } from 'zod';
6
6
  import { runGuardVerification } from '../../core/verification/verify.js';
7
+ import { auditGuardGovernance } from '../../core/audit/governance.js';
7
8
  const rootSchema = z.string().trim().min(1).optional().describe('Project path or workspace root.');
8
9
  function getGuardRoot(root) {
9
10
  return root ? findGuardRoot(root) : findGuardRoot();
@@ -450,9 +451,19 @@ export function registerGuardTools(server) {
450
451
  .boolean()
451
452
  .optional()
452
453
  .describe('Override completionGate.projectChecks for this invocation.'),
454
+ policy_base: z
455
+ .string()
456
+ .trim()
457
+ .min(1)
458
+ .optional()
459
+ .describe('Git ref whose Guard policy should be used for this verification.'),
460
+ fail_on_policy_change: z
461
+ .boolean()
462
+ .optional()
463
+ .describe('Fail when the checked-out policy differs from policy_base.'),
453
464
  iteration: z.number().int().positive().default(1),
454
465
  },
455
- }, ({ root: requestedRoot, checks, changed_only, requirement, tools, strict, project_checks, iteration, }) => {
466
+ }, ({ root: requestedRoot, checks, changed_only, requirement, tools, strict, project_checks, policy_base, fail_on_policy_change, iteration, }) => {
456
467
  const root = getGuardRoot(requestedRoot);
457
468
  const agent = loadAgentSafely(root);
458
469
  if ('error' in agent)
@@ -464,6 +475,8 @@ export function registerGuardTools(server) {
464
475
  tools,
465
476
  strict,
466
477
  projectChecks: project_checks,
478
+ policyBase: policy_base,
479
+ failOnPolicyChange: fail_on_policy_change,
467
480
  });
468
481
  const completionGate = agent.config.completionGate;
469
482
  return jsonToolResult({
@@ -475,6 +488,18 @@ export function registerGuardTools(server) {
475
488
  },
476
489
  }, result.status === 'fail');
477
490
  });
491
+ server.registerTool('codapult_guard_governance', {
492
+ title: 'Guard Governance Audit',
493
+ description: 'Audit declared proposal and approval provenance, policy bindings, and retained verification reachability. This reports metadata; it does not prove identity or signatures.',
494
+ inputSchema: { root: rootSchema },
495
+ }, ({ root: requestedRoot }) => {
496
+ try {
497
+ return jsonToolResult(auditGuardGovernance(getGuardRoot(requestedRoot)));
498
+ }
499
+ catch (error) {
500
+ return jsonToolResult({ status: 'fail', message: error instanceof Error ? error.message : String(error) }, true);
501
+ }
502
+ });
478
503
  server.registerTool('codapult_guard_audit', {
479
504
  title: 'Guard Audit',
480
505
  description: 'Run a full Guard audit, ignoring baseline suppression and validating contracts.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codapult/guard",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "mcpName": "io.github.codapult/guard",
5
5
  "description": "Local-first architecture guardrails for JavaScript and TypeScript projects, with first-class support for Next.js SaaS and AI-assisted development",
6
6
  "license": "MIT",