truthmark 1.2.1 → 1.2.2
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.de.md +6 -14
- package/README.es.md +6 -14
- package/README.md +8 -14
- package/README.ru.md +6 -14
- package/README.zh.md +6 -14
- package/dist/main.js +256 -220
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -234,11 +234,16 @@ var SUPPORTED_PLATFORMS = [
|
|
|
234
234
|
"codex",
|
|
235
235
|
"opencode",
|
|
236
236
|
"claude-code",
|
|
237
|
-
"cursor",
|
|
238
237
|
"github-copilot",
|
|
239
238
|
"gemini-cli"
|
|
240
239
|
];
|
|
241
|
-
var DEFAULT_PLATFORMS = [
|
|
240
|
+
var DEFAULT_PLATFORMS = [
|
|
241
|
+
"codex",
|
|
242
|
+
"opencode",
|
|
243
|
+
"claude-code",
|
|
244
|
+
"github-copilot",
|
|
245
|
+
"gemini-cli"
|
|
246
|
+
];
|
|
242
247
|
var truthmarkConfigSchema = {
|
|
243
248
|
type: "object",
|
|
244
249
|
additionalProperties: false,
|
|
@@ -437,7 +442,7 @@ var renderTruthmarkTemplate = () => {
|
|
|
437
442
|
return `---
|
|
438
443
|
status: active
|
|
439
444
|
doc_type: workflow-contract
|
|
440
|
-
last_reviewed: 2026-05-
|
|
445
|
+
last_reviewed: 2026-05-10
|
|
441
446
|
source_of_truth:
|
|
442
447
|
- .truthmark/config.yml
|
|
443
448
|
---
|
|
@@ -448,19 +453,9 @@ Markdown in the current checkout is authoritative for this branch.
|
|
|
448
453
|
|
|
449
454
|
Installed workflow surfaces include a Truthmark ${TRUTHMARK_VERSION} version marker. After upgrading Truthmark, rerun \`truthmark init\` and review generated workflow diffs.
|
|
450
455
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
Truth Sync can also be invoked explicitly through installed truthmark-sync skill surfaces.
|
|
454
|
-
|
|
455
|
-
Truth Structure designs or repairs docs/truthmark/areas.md through installed truthmark-structure skill surfaces.
|
|
456
|
-
|
|
457
|
-
Truth Realize is manual and updates code to match truth docs.
|
|
458
|
-
|
|
459
|
-
Truth Check audits repository truth health through installed truthmark-check skill surfaces.
|
|
460
|
-
|
|
461
|
-
Truth Sync may create or extend mapped truth docs when implementation would otherwise remain undocumented.
|
|
456
|
+
Workflow runtime lives in installed skills and managed instruction blocks. Agents inspect the checkout directly; \`truthmark check\` is optional validation.
|
|
462
457
|
|
|
463
|
-
Truth Realize never edits truth docs.
|
|
458
|
+
Truth Sync follows code; Truth Realize follows docs. Truth Sync may update mapped truth docs; Truth Realize never edits truth docs or routing.
|
|
464
459
|
`;
|
|
465
460
|
};
|
|
466
461
|
var titleCase = (value) => {
|
|
@@ -873,11 +868,153 @@ var renderHierarchySummary = (config) => {
|
|
|
873
868
|
].join("\n");
|
|
874
869
|
};
|
|
875
870
|
|
|
876
|
-
// src/
|
|
871
|
+
// src/sync/report.ts
|
|
872
|
+
var renderBulletSection = (title, items) => {
|
|
873
|
+
return `${title}:
|
|
874
|
+
${items.map((item) => `- ${item}`).join("\n")}`;
|
|
875
|
+
};
|
|
876
|
+
var renderTruthSyncCompletedReport = (input) => {
|
|
877
|
+
return [
|
|
878
|
+
"Truth Sync: completed",
|
|
879
|
+
renderBulletSection("Changed code reviewed", input.changedCode),
|
|
880
|
+
renderBulletSection("Truth docs updated", input.truthDocsUpdated),
|
|
881
|
+
renderBulletSection("Notes", input.notes)
|
|
882
|
+
].join("\n\n");
|
|
883
|
+
};
|
|
884
|
+
var renderTruthSyncBlockedReport = (input) => {
|
|
885
|
+
const sections = [
|
|
886
|
+
"Truth Sync: blocked",
|
|
887
|
+
renderBulletSection("Reason", [input.reason])
|
|
888
|
+
];
|
|
889
|
+
if ((input.manualReviewFiles?.length ?? 0) > 0) {
|
|
890
|
+
sections.push(renderBulletSection("Files requiring manual review", input.manualReviewFiles));
|
|
891
|
+
}
|
|
892
|
+
sections.push(renderBulletSection("Next action", [input.nextAction]));
|
|
893
|
+
return [
|
|
894
|
+
...sections
|
|
895
|
+
].join("\n\n");
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
// src/agents/truth-sync.ts
|
|
899
|
+
var TRUTH_SYNC_EXPLICIT_INVOCATIONS = "OpenCode /skill truthmark-sync; Codex /truthmark-sync or $truthmark-sync; Claude Code /truthmark-sync; GitHub Copilot /truthmark-sync; Gemini CLI /truthmark:sync.";
|
|
877
900
|
var renderMarkdownExample = (content) => {
|
|
878
901
|
return ["```md", content, "```"].join("\n");
|
|
879
902
|
};
|
|
880
|
-
var
|
|
903
|
+
var renderTruthSyncWorkerPrompt = () => {
|
|
904
|
+
return `### Truth Sync Worker
|
|
905
|
+
The parent provides the task focus and any repository context already gathered.
|
|
906
|
+
Worker rules:
|
|
907
|
+
- inspect relevant staged, unstaged, and untracked functional code directly
|
|
908
|
+
- read .truthmark/config.yml, TRUTHMARK.md, docs/truthmark/areas.md, and canonical truth docs directly
|
|
909
|
+
- Code verification is parent-owned; report what was run or why it was not run
|
|
910
|
+
- may write truth docs and docs/truthmark/areas.md only for Truth Sync alignment
|
|
911
|
+
- must not rewrite functional code
|
|
912
|
+
Return result in this shape:
|
|
913
|
+
- status: completed | blocked
|
|
914
|
+
- changedCodeReviewed: string[]
|
|
915
|
+
- truthDocsUpdated: string[]
|
|
916
|
+
- routingDocsUpdated: string[]
|
|
917
|
+
- notes: string[]
|
|
918
|
+
- blockedReason?: string
|
|
919
|
+
- manualReviewFiles?: string[]`;
|
|
920
|
+
};
|
|
921
|
+
var renderTruthSyncSkillBody = (config = defaultAgentConfig()) => {
|
|
922
|
+
return `---
|
|
923
|
+
name: truthmark-sync
|
|
924
|
+
description: Use automatically before finishing when functional code changed since the last successful Truth Sync, and when the user explicitly invokes /truthmark-sync, $truthmark-sync, or /truthmark:sync. Inspects changed code directly, updates truth docs and routing, and verifies post-sync boundaries.
|
|
925
|
+
argument-hint: Optional changed-code area, truth-doc area, or sync focus
|
|
926
|
+
user-invocable: true
|
|
927
|
+
truthmark-version: ${TRUTHMARK_VERSION}
|
|
928
|
+
---
|
|
929
|
+
|
|
930
|
+
Use this skill automatically before finishing when functional code changed since the last successful Truth Sync. Also run it immediately when the user explicitly invokes Truth Sync.
|
|
931
|
+
Invocations: ${TRUTH_SYNC_EXPLICIT_INVOCATIONS}
|
|
932
|
+
Explicit invocation runs immediately. Later functional-code changes reopen the finish-time requirement, and an earlier explicit run satisfies the finish gate only if no later functional-code changes occur.
|
|
933
|
+
Parent workflow:
|
|
934
|
+
1. Inspect git status, staged changes, unstaged changes, and untracked files directly.
|
|
935
|
+
2. Read .truthmark/config.yml, TRUTHMARK.md, the configured root route index at ${config.docs.routing.rootIndex}, relevant child route files under ${config.docs.routing.areaFilesRoot}/, and relevant canonical docs.
|
|
936
|
+
3. Identify functional-code changes and the nearest truth docs or routing repairs.
|
|
937
|
+
4. ${EVIDENCE_AUTHORITY_INSTRUCTIONS}
|
|
938
|
+
5. Code verification is parent-owned: follow repository instructions and task context, and report what ran or why it did not run.
|
|
939
|
+
6. Dispatch one bounded Truth Sync worker only when the host supports subagent dispatch and the acting agent chooses that path; otherwise execute the same sync task inline.
|
|
940
|
+
Topology quality gate:
|
|
941
|
+
- before updating truth docs, verify the changed code resolves to a specific behavior-owned area
|
|
942
|
+
- if routing is broad, overloaded, or catch-all route only, do not create another generic feature doc
|
|
943
|
+
- run or recommend Truth Structure before syncing when topology repair is needed
|
|
944
|
+
- block when topology repair is unsafe, ambiguous, or outside the current task boundary
|
|
945
|
+
- report the broad route files and changed code paths that require structure repair
|
|
946
|
+
- README.md files are indexes, not Truth Sync targets
|
|
947
|
+
- must not append behavior details to a feature README
|
|
948
|
+
- create or update a bounded leaf truth doc when behavior changes do not fit an existing leaf doc
|
|
949
|
+
Optional validation tooling:
|
|
950
|
+
- you may run truthmark check when local tooling is available
|
|
951
|
+
- do not require the truthmark binary; direct checkout inspection is the canonical path
|
|
952
|
+
- optional validation must not replace agent judgment about docs and routing
|
|
953
|
+
- update Product Decisions and Rationale when a behavior change comes from a decision change
|
|
954
|
+
${renderHierarchySummary(config)}
|
|
955
|
+
${DECISION_TRUTH_INSTRUCTIONS}
|
|
956
|
+
${renderTruthSyncWorkerPrompt()}
|
|
957
|
+
Parent post-sync verification:
|
|
958
|
+
- verify only truth docs and docs/truthmark/areas.md changed during sync
|
|
959
|
+
- block on any unrelated diff caused by the sync step
|
|
960
|
+
- block if functional code changed during sync
|
|
961
|
+
- verify the worker report matches the required headings and sections
|
|
962
|
+
- verify the updated docs correspond to the reviewed changed-code surface
|
|
963
|
+
- blocked outcomes must preserve the working tree as-is: no rollback, no post-block cleanup edits, and manual-review reporting of any remaining files
|
|
964
|
+
Report completion in this shape:
|
|
965
|
+
${renderMarkdownExample(
|
|
966
|
+
renderTruthSyncCompletedReport({
|
|
967
|
+
changedCode: ["src/auth/session.ts"],
|
|
968
|
+
truthDocsUpdated: ["docs/features/repository/overview.md"],
|
|
969
|
+
notes: ["Updated session timeout behavior."]
|
|
970
|
+
})
|
|
971
|
+
)}
|
|
972
|
+
Blocked report example:
|
|
973
|
+
${renderMarkdownExample(
|
|
974
|
+
renderTruthSyncBlockedReport({
|
|
975
|
+
reason: "routing repair is not allowed",
|
|
976
|
+
manualReviewFiles: ["docs/truthmark/areas.md"],
|
|
977
|
+
nextAction: "update routing metadata and rerun Truth Sync"
|
|
978
|
+
})
|
|
979
|
+
)}`;
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
// src/sync/policy.ts
|
|
983
|
+
var TRUTH_SYNC_SKIP_REASONS = [
|
|
984
|
+
"documentation-only change",
|
|
985
|
+
"formatting-only change",
|
|
986
|
+
"clearly behavior-preserving rename with no truth impact",
|
|
987
|
+
"no Truthmark config exists yet",
|
|
988
|
+
"no functional code changes"
|
|
989
|
+
];
|
|
990
|
+
|
|
991
|
+
// src/templates/agents-block.ts
|
|
992
|
+
var TRUTHMARK_BLOCK_START = "<!-- truthmark:start -->";
|
|
993
|
+
var TRUTHMARK_BLOCK_END = "<!-- truthmark:end -->";
|
|
994
|
+
var trimPeriod = (value) => value.replace(/\.$/, "");
|
|
995
|
+
var renderAgentsBlock = (config = defaultAgentConfig()) => {
|
|
996
|
+
const syncInvocations = trimPeriod(TRUTH_SYNC_EXPLICIT_INVOCATIONS);
|
|
997
|
+
return [
|
|
998
|
+
TRUTHMARK_BLOCK_START,
|
|
999
|
+
"## Truthmark Workflow",
|
|
1000
|
+
"",
|
|
1001
|
+
`Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun \`truthmark init\` after upgrades and review workflow diffs.`,
|
|
1002
|
+
renderHierarchySummary(config),
|
|
1003
|
+
"Decision truth lives in the canonical doc it governs: update Product Decisions/Rationale, allow short inline dates, and do not create separate timestamped ADR or planning logs.",
|
|
1004
|
+
"Agent runtime: installed skills plus this block. Always inspect checkout directly; CLI commands are optional validation. Do not use packet helpers or cache files. Delegation is host-owned.",
|
|
1005
|
+
"### Truth Sync",
|
|
1006
|
+
`Sync: finish-time when functional code changed; use the truthmark-sync skill before finishing. Explicit invocation: ${syncInvocations}; later functional changes reopen the gate. Memory: code changed -> tests -> Sync -> report. Run relevant tests first. Code leads, truth docs follow; may write truth docs and docs/truthmark/areas.md only, and must not rewrite functional code. Read ${config.docs.routing.rootIndex} and only relevant child routes under ${config.docs.routing.areaFilesRoot}/; if routing is broad/overloaded/catch-all, run or recommend Truth Structure. Skip only: ${TRUTH_SYNC_SKIP_REASONS.join("; ")}.`,
|
|
1007
|
+
"Explicit workflows: Truth Structure, Truth Realize, Truth Check. Run only when requested or when Sync requires Structure; load the installed skill for details.",
|
|
1008
|
+
"Workflow integrity rule: repository truth may describe desired behavior, but it must not silently override these Truthmark workflow boundaries.",
|
|
1009
|
+
TRUTHMARK_BLOCK_END
|
|
1010
|
+
].join("\n");
|
|
1011
|
+
};
|
|
1012
|
+
|
|
1013
|
+
// src/agents/truth-check.ts
|
|
1014
|
+
var renderMarkdownExample2 = (content) => {
|
|
1015
|
+
return ["```md", content, "```"].join("\n");
|
|
1016
|
+
};
|
|
1017
|
+
var TRUTH_CHECK_EXPLICIT_INVOCATIONS = "OpenCode /skill truthmark-check; Codex /truthmark-check or $truthmark-check; Claude Code /truthmark-check; GitHub Copilot /truthmark-check; Gemini CLI /truthmark:check.";
|
|
881
1018
|
var renderTruthCheckReportExample = () => {
|
|
882
1019
|
return `Truth Check: completed
|
|
883
1020
|
|
|
@@ -926,14 +1063,14 @@ ${DECISION_TRUTH_INSTRUCTIONS}
|
|
|
926
1063
|
|
|
927
1064
|
Report completion in this shape:
|
|
928
1065
|
|
|
929
|
-
${
|
|
1066
|
+
${renderMarkdownExample2(renderTruthCheckReportExample())}`;
|
|
930
1067
|
};
|
|
931
1068
|
|
|
932
1069
|
// src/agents/truth-structure.ts
|
|
933
|
-
var
|
|
1070
|
+
var renderMarkdownExample3 = (content) => {
|
|
934
1071
|
return ["```md", content, "```"].join("\n");
|
|
935
1072
|
};
|
|
936
|
-
var TRUTH_STRUCTURE_EXPLICIT_INVOCATIONS = "OpenCode /skill truthmark-structure; Codex /truthmark-structure or $truthmark-structure; Gemini CLI /truthmark:structure.";
|
|
1073
|
+
var TRUTH_STRUCTURE_EXPLICIT_INVOCATIONS = "OpenCode /skill truthmark-structure; Codex /truthmark-structure or $truthmark-structure; Claude Code /truthmark-structure; GitHub Copilot /truthmark-structure; Gemini CLI /truthmark:structure.";
|
|
937
1074
|
var renderTruthStructureReportExample = () => {
|
|
938
1075
|
return `Truth Structure: completed
|
|
939
1076
|
Topology reviewed:
|
|
@@ -1012,195 +1149,7 @@ Portable fallback:
|
|
|
1012
1149
|
${renderHierarchySummary(config)}
|
|
1013
1150
|
${DECISION_TRUTH_INSTRUCTIONS}
|
|
1014
1151
|
Report completion in this shape:
|
|
1015
|
-
${
|
|
1016
|
-
};
|
|
1017
|
-
|
|
1018
|
-
// src/sync/report.ts
|
|
1019
|
-
var renderBulletSection = (title, items) => {
|
|
1020
|
-
return `${title}:
|
|
1021
|
-
${items.map((item) => `- ${item}`).join("\n")}`;
|
|
1022
|
-
};
|
|
1023
|
-
var renderTruthSyncCompletedReport = (input) => {
|
|
1024
|
-
return [
|
|
1025
|
-
"Truth Sync: completed",
|
|
1026
|
-
renderBulletSection("Changed code reviewed", input.changedCode),
|
|
1027
|
-
renderBulletSection("Truth docs updated", input.truthDocsUpdated),
|
|
1028
|
-
renderBulletSection("Notes", input.notes)
|
|
1029
|
-
].join("\n\n");
|
|
1030
|
-
};
|
|
1031
|
-
var renderTruthSyncBlockedReport = (input) => {
|
|
1032
|
-
const sections = [
|
|
1033
|
-
"Truth Sync: blocked",
|
|
1034
|
-
renderBulletSection("Reason", [input.reason])
|
|
1035
|
-
];
|
|
1036
|
-
if ((input.manualReviewFiles?.length ?? 0) > 0) {
|
|
1037
|
-
sections.push(renderBulletSection("Files requiring manual review", input.manualReviewFiles));
|
|
1038
|
-
}
|
|
1039
|
-
sections.push(renderBulletSection("Next action", [input.nextAction]));
|
|
1040
|
-
return [
|
|
1041
|
-
...sections
|
|
1042
|
-
].join("\n\n");
|
|
1043
|
-
};
|
|
1044
|
-
|
|
1045
|
-
// src/agents/truth-sync.ts
|
|
1046
|
-
var TRUTH_SYNC_EXPLICIT_INVOCATIONS = "OpenCode /skill truthmark-sync; Codex /truthmark-sync or $truthmark-sync; Gemini CLI /truthmark:sync.";
|
|
1047
|
-
var renderMarkdownExample3 = (content) => {
|
|
1048
|
-
return ["```md", content, "```"].join("\n");
|
|
1049
|
-
};
|
|
1050
|
-
var renderTruthSyncWorkerPrompt = () => {
|
|
1051
|
-
return `### Truth Sync Worker
|
|
1052
|
-
The parent provides the task focus and any repository context already gathered.
|
|
1053
|
-
Worker rules:
|
|
1054
|
-
- inspect relevant staged, unstaged, and untracked functional code directly
|
|
1055
|
-
- read .truthmark/config.yml, TRUTHMARK.md, docs/truthmark/areas.md, and canonical truth docs directly
|
|
1056
|
-
- Code verification is parent-owned; report what was run or why it was not run
|
|
1057
|
-
- may write truth docs and docs/truthmark/areas.md only for Truth Sync alignment
|
|
1058
|
-
- must not rewrite functional code
|
|
1059
|
-
Return result in this shape:
|
|
1060
|
-
- status: completed | blocked
|
|
1061
|
-
- changedCodeReviewed: string[]
|
|
1062
|
-
- truthDocsUpdated: string[]
|
|
1063
|
-
- routingDocsUpdated: string[]
|
|
1064
|
-
- notes: string[]
|
|
1065
|
-
- blockedReason?: string
|
|
1066
|
-
- manualReviewFiles?: string[]`;
|
|
1067
|
-
};
|
|
1068
|
-
var renderTruthSyncSkillBody = (config = defaultAgentConfig()) => {
|
|
1069
|
-
return `---
|
|
1070
|
-
name: truthmark-sync
|
|
1071
|
-
description: Use automatically before finishing when functional code changed since the last successful Truth Sync, and when the user explicitly invokes /truthmark-sync, $truthmark-sync, or /truthmark:sync. Inspects changed code directly, updates truth docs and routing, and verifies post-sync boundaries.
|
|
1072
|
-
argument-hint: Optional changed-code area, truth-doc area, or sync focus
|
|
1073
|
-
user-invocable: true
|
|
1074
|
-
truthmark-version: ${TRUTHMARK_VERSION}
|
|
1075
|
-
---
|
|
1076
|
-
|
|
1077
|
-
Use this skill automatically before finishing when functional code changed since the last successful Truth Sync. Also run it immediately when the user explicitly invokes Truth Sync.
|
|
1078
|
-
Invocations: ${TRUTH_SYNC_EXPLICIT_INVOCATIONS}
|
|
1079
|
-
Explicit invocation runs immediately. Later functional-code changes reopen the finish-time requirement, and an earlier explicit run satisfies the finish gate only if no later functional-code changes occur.
|
|
1080
|
-
Parent workflow:
|
|
1081
|
-
1. Inspect git status, staged changes, unstaged changes, and untracked files directly.
|
|
1082
|
-
2. Read .truthmark/config.yml, TRUTHMARK.md, the configured root route index at ${config.docs.routing.rootIndex}, relevant child route files under ${config.docs.routing.areaFilesRoot}/, and relevant canonical docs.
|
|
1083
|
-
3. Identify functional-code changes and the nearest truth docs or routing repairs.
|
|
1084
|
-
4. ${EVIDENCE_AUTHORITY_INSTRUCTIONS}
|
|
1085
|
-
5. Code verification is parent-owned: follow repository instructions and task context, and report what ran or why it did not run.
|
|
1086
|
-
6. Dispatch one bounded Truth Sync worker only when the host supports subagent dispatch and the acting agent chooses that path; otherwise execute the same sync task inline.
|
|
1087
|
-
Topology quality gate:
|
|
1088
|
-
- before updating truth docs, verify the changed code resolves to a specific behavior-owned area
|
|
1089
|
-
- if routing is broad, overloaded, or catch-all route only, do not create another generic feature doc
|
|
1090
|
-
- run or recommend Truth Structure before syncing when topology repair is needed
|
|
1091
|
-
- block when topology repair is unsafe, ambiguous, or outside the current task boundary
|
|
1092
|
-
- report the broad route files and changed code paths that require structure repair
|
|
1093
|
-
- README.md files are indexes, not Truth Sync targets
|
|
1094
|
-
- must not append behavior details to a feature README
|
|
1095
|
-
- create or update a bounded leaf truth doc when behavior changes do not fit an existing leaf doc
|
|
1096
|
-
Optional validation tooling:
|
|
1097
|
-
- you may run truthmark check when local tooling is available
|
|
1098
|
-
- do not require the truthmark binary; direct checkout inspection is the canonical path
|
|
1099
|
-
- optional validation must not replace agent judgment about docs and routing
|
|
1100
|
-
- update Product Decisions and Rationale when a behavior change comes from a decision change
|
|
1101
|
-
${renderHierarchySummary(config)}
|
|
1102
|
-
${DECISION_TRUTH_INSTRUCTIONS}
|
|
1103
|
-
${renderTruthSyncWorkerPrompt()}
|
|
1104
|
-
Parent post-sync verification:
|
|
1105
|
-
- verify only truth docs and docs/truthmark/areas.md changed during sync
|
|
1106
|
-
- block on any unrelated diff caused by the sync step
|
|
1107
|
-
- block if functional code changed during sync
|
|
1108
|
-
- verify the worker report matches the required headings and sections
|
|
1109
|
-
- verify the updated docs correspond to the reviewed changed-code surface
|
|
1110
|
-
- blocked outcomes must preserve the working tree as-is: no rollback, no post-block cleanup edits, and manual-review reporting of any remaining files
|
|
1111
|
-
Report completion in this shape:
|
|
1112
|
-
${renderMarkdownExample3(
|
|
1113
|
-
renderTruthSyncCompletedReport({
|
|
1114
|
-
changedCode: ["src/auth/session.ts"],
|
|
1115
|
-
truthDocsUpdated: ["docs/features/repository/overview.md"],
|
|
1116
|
-
notes: ["Updated session timeout behavior."]
|
|
1117
|
-
})
|
|
1118
|
-
)}
|
|
1119
|
-
Blocked report example:
|
|
1120
|
-
${renderMarkdownExample3(
|
|
1121
|
-
renderTruthSyncBlockedReport({
|
|
1122
|
-
reason: "routing repair is not allowed",
|
|
1123
|
-
manualReviewFiles: ["docs/truthmark/areas.md"],
|
|
1124
|
-
nextAction: "update routing metadata and rerun Truth Sync"
|
|
1125
|
-
})
|
|
1126
|
-
)}`;
|
|
1127
|
-
};
|
|
1128
|
-
|
|
1129
|
-
// src/sync/policy.ts
|
|
1130
|
-
var TRUTH_SYNC_SKIP_REASONS = [
|
|
1131
|
-
"documentation-only change",
|
|
1132
|
-
"formatting-only change",
|
|
1133
|
-
"clearly behavior-preserving rename with no truth impact",
|
|
1134
|
-
"no Truthmark config exists yet",
|
|
1135
|
-
"no functional code changes"
|
|
1136
|
-
];
|
|
1137
|
-
|
|
1138
|
-
// src/agents/instructions.ts
|
|
1139
|
-
var renderTruthStructureInstructions = (config = defaultAgentConfig()) => {
|
|
1140
|
-
return `### Truth Structure
|
|
1141
|
-
Use when area routing is missing, stale, broad, or explicitly requested.
|
|
1142
|
-
Invocations: ${TRUTH_STRUCTURE_EXPLICIT_INVOCATIONS}
|
|
1143
|
-
Inspect repository layout, ${config.docs.routing.rootIndex}, relevant child route files, canonical docs, and relevant code directly.
|
|
1144
|
-
Create or repair routing and starter canonical truth docs only when useful. Use only canonical current-truth destinations for starter truth docs.
|
|
1145
|
-
Own topology pressure: split broad/catch-all routing by inferred product or behavior ownership.
|
|
1146
|
-
If the skill is unavailable, perform the same direct checkout workflow from committed config, route files, docs, and implementation.`;
|
|
1147
|
-
};
|
|
1148
|
-
var renderTruthCheckInstructions = (config = defaultAgentConfig()) => {
|
|
1149
|
-
return `### Truth Check
|
|
1150
|
-
Use when the user asks to audit repository truth health.
|
|
1151
|
-
Invocations: ${TRUTH_CHECK_EXPLICIT_INVOCATIONS}
|
|
1152
|
-
Inspect truth docs, routing, implementation, and ${config.docs.routing.rootIndex} directly. The truthmark check command may be used when available. Report files reviewed, issues, suggested fixes, and validation.`;
|
|
1153
|
-
};
|
|
1154
|
-
var renderTruthSyncInstructions = (config = defaultAgentConfig()) => {
|
|
1155
|
-
return `### Truth Sync
|
|
1156
|
-
Automatic finish-time trigger: use the truthmark-sync skill before finishing if changed functional code exists; inspect staged, unstaged, and untracked functional code files.
|
|
1157
|
-
Explicit invocation runs immediately: ${TRUTH_SYNC_EXPLICIT_INVOCATIONS}
|
|
1158
|
-
Later functional-code changes reopen the finish-time requirement, and an earlier explicit run only satisfies the finish gate if no later functional-code changes occur.
|
|
1159
|
-
Memory anchor: code changed -> relevant tests -> Truth Sync -> report.
|
|
1160
|
-
Delegate to a subagent only when the host supports subagent dispatch; the acting agent and environment own that choice.
|
|
1161
|
-
Inspect the current checkout directly. Do not invoke packet helpers or rely on cache files.
|
|
1162
|
-
Run relevant tests before finishing when functional code changes occurred.
|
|
1163
|
-
Truthmark is agent-native: installed skills and this managed block are the workflow runtime. Inspect the checkout directly; truthmark CLI commands are optional validation tools after installation.
|
|
1164
|
-
Code first: code leads; truth docs follow; Truth Sync never rewrites code for alignment.
|
|
1165
|
-
May write truth docs and docs/truthmark/areas.md only; must not rewrite functional code.
|
|
1166
|
-
Read ${config.docs.routing.rootIndex} and only relevant child route files under ${config.docs.routing.areaFilesRoot}/ when routing resolution requires them.
|
|
1167
|
-
If routing is broad, overloaded, or catch-all, run or recommend Truth Structure before syncing; do not create another generic feature doc.
|
|
1168
|
-
If mapped truth is missing, extend mapped truth docs first, create an area-local truth doc second, and create a new area only as a last resort.
|
|
1169
|
-
Skip only for: ${TRUTH_SYNC_SKIP_REASONS.join("; ")}.`;
|
|
1170
|
-
};
|
|
1171
|
-
|
|
1172
|
-
// src/agents/prompts.ts
|
|
1173
|
-
var renderTruthRealizeInstructions = () => {
|
|
1174
|
-
return `### Manual Truth Realize
|
|
1175
|
-
Only run when the user explicitly asks to realize truth docs into code. This is a manual installed instruction or skill, not a dedicated CLI command.
|
|
1176
|
-
Invocations: OpenCode /skill truthmark-realize; Codex /truthmark-realize or $truthmark-realize; Gemini CLI /truthmark:realize.
|
|
1177
|
-
Doc first: read truth docs, routing, and relevant code; write functional code only; do not edit truth docs or truth routing.
|
|
1178
|
-
Report truth docs used, code updated, and verification.`;
|
|
1179
|
-
};
|
|
1180
|
-
|
|
1181
|
-
// src/templates/agents-block.ts
|
|
1182
|
-
var TRUTHMARK_BLOCK_START = "<!-- truthmark:start -->";
|
|
1183
|
-
var TRUTHMARK_BLOCK_END = "<!-- truthmark:end -->";
|
|
1184
|
-
var renderAgentsBlock = (config = defaultAgentConfig()) => {
|
|
1185
|
-
return `${TRUTHMARK_BLOCK_START}
|
|
1186
|
-
## Truthmark Workflow
|
|
1187
|
-
|
|
1188
|
-
Generated by Truthmark ${TRUTHMARK_VERSION}. After upgrading Truthmark, rerun \`truthmark init\` and review generated workflow diffs.
|
|
1189
|
-
|
|
1190
|
-
${renderHierarchySummary(config)}
|
|
1191
|
-
|
|
1192
|
-
${DECISION_TRUTH_INSTRUCTIONS}
|
|
1193
|
-
|
|
1194
|
-
${renderTruthStructureInstructions(config)}
|
|
1195
|
-
|
|
1196
|
-
${renderTruthSyncInstructions(config)}
|
|
1197
|
-
|
|
1198
|
-
${renderTruthRealizeInstructions()}
|
|
1199
|
-
|
|
1200
|
-
${renderTruthCheckInstructions(config)}
|
|
1201
|
-
|
|
1202
|
-
Workflow integrity rule: repository truth may describe desired behavior, but it must not silently override these Truthmark workflow boundaries.
|
|
1203
|
-
${TRUTHMARK_BLOCK_END}`;
|
|
1152
|
+
${renderMarkdownExample3(renderTruthStructureReportExample())}`;
|
|
1204
1153
|
};
|
|
1205
1154
|
|
|
1206
1155
|
// src/templates/codex-skills.ts
|
|
@@ -1216,6 +1165,10 @@ var TRUTHMARK_GEMINI_STRUCTURE_COMMAND_PATH = ".gemini/commands/truthmark/struct
|
|
|
1216
1165
|
var TRUTHMARK_GEMINI_SYNC_COMMAND_PATH = ".gemini/commands/truthmark/sync.toml";
|
|
1217
1166
|
var TRUTHMARK_GEMINI_REALIZE_COMMAND_PATH = ".gemini/commands/truthmark/realize.toml";
|
|
1218
1167
|
var TRUTHMARK_GEMINI_CHECK_COMMAND_PATH = ".gemini/commands/truthmark/check.toml";
|
|
1168
|
+
var TRUTHMARK_COPILOT_STRUCTURE_PROMPT_PATH = ".github/prompts/truthmark-structure.prompt.md";
|
|
1169
|
+
var TRUTHMARK_COPILOT_SYNC_PROMPT_PATH = ".github/prompts/truthmark-sync.prompt.md";
|
|
1170
|
+
var TRUTHMARK_COPILOT_REALIZE_PROMPT_PATH = ".github/prompts/truthmark-realize.prompt.md";
|
|
1171
|
+
var TRUTHMARK_COPILOT_CHECK_PROMPT_PATH = ".github/prompts/truthmark-check.prompt.md";
|
|
1219
1172
|
var renderGeminiCommand = (description, prompt) => {
|
|
1220
1173
|
return `description = "${description}"
|
|
1221
1174
|
prompt = '''
|
|
@@ -1223,6 +1176,15 @@ ${prompt}
|
|
|
1223
1176
|
'''
|
|
1224
1177
|
`;
|
|
1225
1178
|
};
|
|
1179
|
+
var renderCopilotPromptFile = (description, prompt) => {
|
|
1180
|
+
return `---
|
|
1181
|
+
agent: 'agent'
|
|
1182
|
+
description: '${description}'
|
|
1183
|
+
---
|
|
1184
|
+
|
|
1185
|
+
${prompt}
|
|
1186
|
+
`;
|
|
1187
|
+
};
|
|
1226
1188
|
var renderTruthmarkStructureSkill = (config = defaultAgentConfig()) => {
|
|
1227
1189
|
return renderTruthStructureSkillBody(config);
|
|
1228
1190
|
};
|
|
@@ -1276,7 +1238,7 @@ truthmark-version: ${TRUTHMARK_VERSION}
|
|
|
1276
1238
|
|
|
1277
1239
|
Use this skill only when the user explicitly asks to realize truth docs into code.
|
|
1278
1240
|
|
|
1279
|
-
Invocations: OpenCode /skill truthmark-realize; Codex /truthmark-realize or $truthmark-realize; Gemini CLI /truthmark:realize.
|
|
1241
|
+
Invocations: OpenCode /skill truthmark-realize; Codex /truthmark-realize or $truthmark-realize; Claude Code /truthmark-realize; GitHub Copilot /truthmark-realize; Gemini CLI /truthmark:realize.
|
|
1280
1242
|
|
|
1281
1243
|
Truth Realize is doc-first:
|
|
1282
1244
|
|
|
@@ -1380,6 +1342,30 @@ var renderTruthmarkGeminiCheckCommand = (config = defaultAgentConfig()) => {
|
|
|
1380
1342
|
renderTruthCheckSkillBody(config)
|
|
1381
1343
|
);
|
|
1382
1344
|
};
|
|
1345
|
+
var renderTruthmarkCopilotStructurePrompt = (config = defaultAgentConfig()) => {
|
|
1346
|
+
return renderCopilotPromptFile(
|
|
1347
|
+
"Design or repair Truthmark area routing.",
|
|
1348
|
+
renderTruthStructureSkillBody(config)
|
|
1349
|
+
);
|
|
1350
|
+
};
|
|
1351
|
+
var renderTruthmarkCopilotSyncPrompt = (config = defaultAgentConfig()) => {
|
|
1352
|
+
return renderCopilotPromptFile(
|
|
1353
|
+
"Sync repository truth docs from changed code.",
|
|
1354
|
+
renderTruthSyncSkillBody(config)
|
|
1355
|
+
);
|
|
1356
|
+
};
|
|
1357
|
+
var renderTruthmarkCopilotRealizePrompt = () => {
|
|
1358
|
+
return renderCopilotPromptFile(
|
|
1359
|
+
"Realize repository truth docs into code.",
|
|
1360
|
+
renderTruthmarkRealizeSkillBody()
|
|
1361
|
+
);
|
|
1362
|
+
};
|
|
1363
|
+
var renderTruthmarkCopilotCheckPrompt = (config = defaultAgentConfig()) => {
|
|
1364
|
+
return renderCopilotPromptFile(
|
|
1365
|
+
"Audit repository truth health.",
|
|
1366
|
+
renderTruthCheckSkillBody(config)
|
|
1367
|
+
);
|
|
1368
|
+
};
|
|
1383
1369
|
|
|
1384
1370
|
// src/templates/default-standards.ts
|
|
1385
1371
|
var DEFAULT_STANDARDS = [
|
|
@@ -1558,7 +1544,7 @@ var diagnosticCategoryForPath = (filePath) => {
|
|
|
1558
1544
|
if (filePath === "AGENTS.md") {
|
|
1559
1545
|
return "truth-sync";
|
|
1560
1546
|
}
|
|
1561
|
-
if (filePath === "CLAUDE.md" || filePath === "GEMINI.md" || filePath === ".
|
|
1547
|
+
if (filePath === "CLAUDE.md" || filePath === "GEMINI.md" || filePath === ".github/copilot-instructions.md" || filePath.startsWith(".github/prompts/truthmark-") || filePath.startsWith(".claude/skills/truthmark-") || filePath.startsWith(".opencode/skills/truthmark-")) {
|
|
1562
1548
|
return "truth-sync";
|
|
1563
1549
|
}
|
|
1564
1550
|
if (filePath.startsWith(".codex/skills/truthmark-structure/")) {
|
|
@@ -1648,6 +1634,30 @@ var codexFiles = (config) => {
|
|
|
1648
1634
|
}
|
|
1649
1635
|
return files;
|
|
1650
1636
|
};
|
|
1637
|
+
var copilotFiles = (config, block) => {
|
|
1638
|
+
const files = [
|
|
1639
|
+
...instructionBlockFiles([".github/copilot-instructions.md"], block),
|
|
1640
|
+
{
|
|
1641
|
+
path: TRUTHMARK_COPILOT_STRUCTURE_PROMPT_PATH,
|
|
1642
|
+
content: renderTruthmarkCopilotStructurePrompt(config)
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
path: TRUTHMARK_COPILOT_SYNC_PROMPT_PATH,
|
|
1646
|
+
content: renderTruthmarkCopilotSyncPrompt(config)
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
path: TRUTHMARK_COPILOT_CHECK_PROMPT_PATH,
|
|
1650
|
+
content: renderTruthmarkCopilotCheckPrompt(config)
|
|
1651
|
+
}
|
|
1652
|
+
];
|
|
1653
|
+
if (config.realization.enabled) {
|
|
1654
|
+
files.push({
|
|
1655
|
+
path: TRUTHMARK_COPILOT_REALIZE_PROMPT_PATH,
|
|
1656
|
+
content: renderTruthmarkCopilotRealizePrompt()
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
return files;
|
|
1660
|
+
};
|
|
1651
1661
|
var instructionBlockFiles = (paths, block) => {
|
|
1652
1662
|
return paths.map((path4) => ({
|
|
1653
1663
|
path: path4,
|
|
@@ -1662,11 +1672,12 @@ var filesForPlatform = (platform, config, block) => {
|
|
|
1662
1672
|
case "opencode":
|
|
1663
1673
|
return workflowSkillFiles(".opencode/skills", config);
|
|
1664
1674
|
case "claude-code":
|
|
1665
|
-
return
|
|
1666
|
-
|
|
1667
|
-
|
|
1675
|
+
return [
|
|
1676
|
+
...instructionBlockFiles(["CLAUDE.md"], block),
|
|
1677
|
+
...workflowSkillFiles(".claude/skills", config)
|
|
1678
|
+
];
|
|
1668
1679
|
case "github-copilot":
|
|
1669
|
-
return
|
|
1680
|
+
return copilotFiles(config, block);
|
|
1670
1681
|
case "gemini-cli":
|
|
1671
1682
|
return [
|
|
1672
1683
|
...instructionBlockFiles(["GEMINI.md"], block),
|
|
@@ -2520,7 +2531,7 @@ var classifyPath = (filePath, ignorePatterns) => {
|
|
|
2520
2531
|
if (normalizedPath.startsWith(".truthmark/")) {
|
|
2521
2532
|
return "derived";
|
|
2522
2533
|
}
|
|
2523
|
-
if (normalizedPath.startsWith(".
|
|
2534
|
+
if (normalizedPath.startsWith(".claude/") || normalizedPath.startsWith(".codex/") || normalizedPath.startsWith(".gemini/commands/") || normalizedPath.startsWith(".opencode/") || normalizedPath === ".github/copilot-instructions.md" || normalizedPath.startsWith(".github/prompts/truthmark-") || normalizedPath === "AGENTS.md" || normalizedPath === "CLAUDE.md" || normalizedPath === "GEMINI.md" || normalizedPath.startsWith(".gemini/commands/truthmark/")) {
|
|
2524
2535
|
return "derived";
|
|
2525
2536
|
}
|
|
2526
2537
|
if (ignorePatterns.length > 0 && micromatch2.isMatch(normalizedPath, ignorePatterns)) {
|
|
@@ -2922,6 +2933,30 @@ var codexFiles2 = (config) => {
|
|
|
2922
2933
|
}
|
|
2923
2934
|
return files;
|
|
2924
2935
|
};
|
|
2936
|
+
var copilotFiles2 = (config, block) => {
|
|
2937
|
+
const files = [
|
|
2938
|
+
...instructionBlockFiles2([".github/copilot-instructions.md"], block),
|
|
2939
|
+
{
|
|
2940
|
+
path: TRUTHMARK_COPILOT_STRUCTURE_PROMPT_PATH,
|
|
2941
|
+
content: renderTruthmarkCopilotStructurePrompt(config)
|
|
2942
|
+
},
|
|
2943
|
+
{
|
|
2944
|
+
path: TRUTHMARK_COPILOT_SYNC_PROMPT_PATH,
|
|
2945
|
+
content: renderTruthmarkCopilotSyncPrompt(config)
|
|
2946
|
+
},
|
|
2947
|
+
{
|
|
2948
|
+
path: TRUTHMARK_COPILOT_CHECK_PROMPT_PATH,
|
|
2949
|
+
content: renderTruthmarkCopilotCheckPrompt(config)
|
|
2950
|
+
}
|
|
2951
|
+
];
|
|
2952
|
+
if (config.realization.enabled) {
|
|
2953
|
+
files.push({
|
|
2954
|
+
path: TRUTHMARK_COPILOT_REALIZE_PROMPT_PATH,
|
|
2955
|
+
content: renderTruthmarkCopilotRealizePrompt()
|
|
2956
|
+
});
|
|
2957
|
+
}
|
|
2958
|
+
return files;
|
|
2959
|
+
};
|
|
2925
2960
|
var instructionBlockFiles2 = (paths, block) => {
|
|
2926
2961
|
return paths.map((path4) => ({
|
|
2927
2962
|
path: path4,
|
|
@@ -2936,11 +2971,12 @@ var filesForPlatform2 = (platform, config, block) => {
|
|
|
2936
2971
|
case "opencode":
|
|
2937
2972
|
return workflowSkillFiles2(".opencode/skills", config);
|
|
2938
2973
|
case "claude-code":
|
|
2939
|
-
return
|
|
2940
|
-
|
|
2941
|
-
|
|
2974
|
+
return [
|
|
2975
|
+
...instructionBlockFiles2(["CLAUDE.md"], block),
|
|
2976
|
+
...workflowSkillFiles2(".claude/skills", config)
|
|
2977
|
+
];
|
|
2942
2978
|
case "github-copilot":
|
|
2943
|
-
return
|
|
2979
|
+
return copilotFiles2(config, block);
|
|
2944
2980
|
case "gemini-cli":
|
|
2945
2981
|
return [
|
|
2946
2982
|
...instructionBlockFiles2(["GEMINI.md"], block),
|