Files
trackgo-fe/.agents/skills/archify/test/authoring-safety-contract.test.mjs
T
shancheas 166e0d40ac feat: introduce archify skill for generating architecture diagrams
- Added a new Archify skill, enabling users to create polished architecture, workflow, sequence, data-flow, and lifecycle diagrams.
- Implemented comprehensive functionality including rendering, validation, and delivery of diagrams in various formats.
- Integrated a user-friendly command-line interface for generating and previewing diagrams.
- Developed supporting files including package.json, LICENSE, and SKILL.md for documentation and licensing.
- Added unit tests to ensure reliability and functionality of the new skill.

These changes enhance the application by providing a structured approach to visualizing system architecture and workflows, improving user experience and data representation.
2026-08-31 11:31:29 +07:00

52 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const skillRoot = path.resolve(__dirname, '..');
const skill = fs.readFileSync(path.join(skillRoot, 'SKILL.md'), 'utf8');
const authoringContract = fs.readFileSync(
path.join(skillRoot, 'references', 'authoring-contract.md'),
'utf8',
);
const schemaReadme = fs.readFileSync(path.join(skillRoot, 'schemas', 'README.md'), 'utf8');
test('semantic relationship labels are preserved and deletion is not a geometry repair', () => {
for (const [name, source] of [['SKILL.md', skill], ['authoring contract', authoringContract]]) {
assert.match(source, /Relationship labels are semantic data/i, name);
assert.match(source, /move the label[\s\S]*adjust the route or spacing[\s\S]*shorten/i, name);
assert.match(source, /protocol[\s\S]*action[\s\S]*direction[\s\S]*synchronous[\s\S]*asynchronous[\s\S]*cross-boundary mechanism/i, name);
assert.match(source, /Omit only wording[\s\S]*fully implied by both endpoints/i, name);
assert.match(source, /Preserve every meaningful label/i, name);
assert.match(source, /deleting it is not\s+a (?:geometry|spacing) repair/i, name);
}
});
test('schema policy documents the workflow v1/v2 compatibility boundary', () => {
assert.match(schemaReadme, /Workflow[^\n]*schema versions? 1 and 2/i);
assert.match(schemaReadme, /other four[^\n]*schema_version[^\n]*1/i);
assert.doesNotMatch(schemaReadme, /schema_version` is `"const": 1`/);
});
test('deployment ownership stays explicit, fact-backed, and cannot be removed to pass', () => {
assert.match(skill, /Omit `meta\.engineering_profile` by default/);
assert.match(skill, /Region.*cluster.*security boundar.*do not.*enable/i);
assert.match(skill, /production deployment topology.*ownership.*fail-closed deployment review/i);
assert.match(skill, /must not remove.*engineering profile.*pass validation/i);
});
test('visual-check stays a pending sidecar receipt instead of a polish claim', () => {
const deliveryContract = fs.readFileSync(
path.join(skillRoot, 'references', 'delivery-contract.md'),
'utf8',
);
for (const [name, source] of [['SKILL.md', skill], ['delivery contract', deliveryContract]]) {
assert.match(source, /visual-check <output\.html> --json/, name);
assert.match(source, /1440×900[\s\S]*1600×1000[\s\S]*1920×1080[\s\S]*2048×1320/, name);
assert.match(source, /visualReview: "pending"/, name);
assert.match(source, /never changes.*delivered|without (?:rerendering or )?modifying/i, name);
}
});