@flancer32/skill-adsm-ctx 0.2.1 → 0.3.0
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/CHANGELOG.md +14 -0
- package/README.md +37 -14
- package/bin/adsm-ctx.mjs +44 -0
- package/package.json +65 -11
- package/skill/SKILL.md +2 -2
- package/skill/references/context-lifecycle.md +3 -3
- package/skill/references/document-projections.md +7 -65
- package/skill/references/documentation-quality-audit.md +22 -14
- package/skill/references/semantic-skins.md +65 -0
- package/skill/templates/work/context/semantic-skin.md +11 -22
- package/src/Cli/Command/Design.mjs +17 -0
- package/src/Cli/Command/Init.mjs +22 -0
- package/src/Cli/Command/InstallSkill.mjs +18 -0
- package/src/Cli/Command/Upgrade.mjs +19 -0
- package/src/Cli/Command/Validate.mjs +19 -0
- package/src/Shared/Constants.mjs +0 -4
- package/src/Validate/Service.mjs +14 -178
- package/types.d.ts +5 -2
- package/.github/workflows/flows-app.yaml +0 -95
- package/AGENTS.md +0 -112
- package/bin/cli.mjs +0 -55
- package/ctx/AGENTS.md +0 -44
- package/ctx/README.md +0 -24
- package/ctx/adsm.json +0 -5
- package/ctx/agent/AGENTS.md +0 -41
- package/ctx/agent/flows/.img/flancer32-skill-adsm-ctx-github-flows.png +0 -0
- package/ctx/agent/flows/AGENTS.md +0 -37
- package/ctx/agent/flows/cfg/issues/labeled/accepted/profile.json +0 -25
- package/ctx/agent/flows/cfg/issues/labeled/accepted/prompt.md +0 -104
- package/ctx/agent/flows/cfg/issues/labeled/clarification-provided/profile.json +0 -15
- package/ctx/agent/flows/cfg/issues/labeled/clarification-provided/prompt.md +0 -63
- package/ctx/agent/flows/cfg/issues/opened/admission/profile.json +0 -14
- package/ctx/agent/flows/cfg/issues/opened/admission/prompt.md +0 -110
- package/ctx/agent/flows/cfg/profile.json +0 -40
- package/ctx/agent/flows/cfg/pull_request/closed/merged/profile.json +0 -15
- package/ctx/agent/flows/cfg/pull_request/closed/merged/prompt.md +0 -41
- package/ctx/agent/flows/cfg/pull_request/labeled/needs-fix/profile.json +0 -25
- package/ctx/agent/flows/cfg/pull_request/labeled/needs-fix/prompt.md +0 -79
- package/ctx/agent/flows/cfg/pull_request/labeled/ready-for-validation/profile.json +0 -15
- package/ctx/agent/flows/cfg/pull_request/labeled/ready-for-validation/prompt.md +0 -72
- package/ctx/agent/flows/cfg/pull_request/labeled/verified/profile.json +0 -15
- package/ctx/agent/flows/cfg/pull_request/labeled/verified/prompt.md +0 -48
- package/ctx/agent/flows/deployment.md +0 -116
- package/ctx/agent/flows/labels.md +0 -108
- package/ctx/agent/flows/overview.md +0 -82
- package/ctx/agent/prompt/cli/ai-intro.md +0 -141
- package/ctx/assets/.gitkeep +0 -1
- package/ctx/docs/AGENTS.md +0 -121
- package/ctx/docs/ai-intro.md +0 -37
- package/ctx/docs/architecture/AGENTS.md +0 -98
- package/ctx/docs/architecture/behavior.md +0 -68
- package/ctx/docs/architecture/checklists.md +0 -48
- package/ctx/docs/architecture/constraints.md +0 -53
- package/ctx/docs/architecture/constraints.skin.en.md +0 -38
- package/ctx/docs/architecture/decisions.md +0 -118
- package/ctx/docs/architecture/integration.md +0 -31
- package/ctx/docs/architecture/overview.md +0 -76
- package/ctx/docs/architecture/state.md +0 -50
- package/ctx/docs/architecture/structure.md +0 -38
- package/ctx/docs/architecture/supervision.md +0 -71
- package/ctx/docs/code/AGENTS.md +0 -51
- package/ctx/docs/code/overview.md +0 -53
- package/ctx/docs/code/testing.md +0 -26
- package/ctx/docs/environment/AGENTS.md +0 -50
- package/ctx/docs/environment/overview.md +0 -33
- package/ctx/docs/filesystem.md +0 -44
- package/ctx/docs/product/AGENTS.md +0 -51
- package/ctx/docs/product/domain.md +0 -63
- package/ctx/docs/product/domain.skin.en.md +0 -40
- package/ctx/docs/product/glossary.md +0 -31
- package/ctx/docs/product/overview.md +0 -112
- package/ctx/docs/product/overview.skin.en.md +0 -38
- package/ctx/docs/product/roles.md +0 -17
- package/ctx/docs/product/use-cases.md +0 -15
- package/src/Bootstrap/Cli.mjs +0 -62
- package/src/Bootstrap.mjs +0 -108
- package/test/integration/.gitkeep +0 -1
- package/test/integration/cli-help.test.mjs +0 -15
- package/test/integration/cli-init-validate.test.mjs +0 -223
- package/test/integration/cli-install-skill.test.mjs +0 -41
- package/test/unit/Bootstrap/Cli.test.mjs +0 -23
- package/test/unit/Bootstrap.test.mjs +0 -53
- package/test/unit/Design/Service.test.mjs +0 -11
- package/test/unit/Init/Service.test.mjs +0 -51
- package/test/unit/Shared/Constants.test.mjs +0 -21
- package/test/unit/Shared/CopyDirectory.test.mjs +0 -31
- package/test/unit/Shared/Metadata.test.mjs +0 -9
- package/test/unit/Shared/Path.test.mjs +0 -11
- package/test/unit/Skill/Installer.test.mjs +0 -20
- package/test/unit/Upgrade/Service.test.mjs +0 -13
- package/test/unit/Validate/Service.test.mjs +0 -760
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import processModule from "node:process";
|
|
4
|
+
|
|
5
|
+
/** @namespace Fl32_Skill_Adsm_Ctx_Cli_Command_Upgrade */
|
|
6
|
+
export default class Upgrade {
|
|
7
|
+
constructor({config, upgrade}) {
|
|
8
|
+
this.id = "adsm-ctx:upgrade";
|
|
9
|
+
this.summary = "Upgrade an ADSM context.";
|
|
10
|
+
this.lifetime = "finite";
|
|
11
|
+
this.execute = async function ({args}) {
|
|
12
|
+
const result = await upgrade.execute({targetPath: args["target-path"] ?? config.cwd});
|
|
13
|
+
processModule.stdout.write(`${result.message}\n`);
|
|
14
|
+
if (!result.ok) throw new Error(result.message);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const __deps__ = Object.freeze({default: Object.freeze({config: "TeqFw_Cli_Config$", upgrade: "Fl32_Skill_Adsm_Ctx_Upgrade_Service$"})});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import processModule from "node:process";
|
|
4
|
+
|
|
5
|
+
/** @namespace Fl32_Skill_Adsm_Ctx_Cli_Command_Validate */
|
|
6
|
+
export default class Validate {
|
|
7
|
+
constructor({config, validate}) {
|
|
8
|
+
this.id = "adsm-ctx:validate";
|
|
9
|
+
this.summary = "Validate an ADSM context.";
|
|
10
|
+
this.lifetime = "finite";
|
|
11
|
+
this.execute = async function ({args}) {
|
|
12
|
+
const result = await validate.execute({targetPath: args["target-path"] ?? config.cwd});
|
|
13
|
+
processModule.stdout.write(`${validate.format({result})}\n`);
|
|
14
|
+
if (!result.ok) throw new Error("ADSM context validation failed.");
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const __deps__ = Object.freeze({default: Object.freeze({config: "TeqFw_Cli_Config$", validate: "Fl32_Skill_Adsm_Ctx_Validate_Service$"})});
|
package/src/Shared/Constants.mjs
CHANGED
|
@@ -9,10 +9,6 @@ export default class Constants {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
this.CONTEXT_SCHEMA = "adsm-context";
|
|
11
11
|
this.CONTEXT_VERSION = "0.1.0";
|
|
12
|
-
this.SKIN_WORD_WARN = 160;
|
|
13
|
-
this.SKIN_WORD_ERROR = 240;
|
|
14
|
-
this.SKIN_LIST_WARN = 12;
|
|
15
|
-
this.SKIN_LIST_ERROR = 20;
|
|
16
12
|
this.DOC_LEVEL_MAX_DIRECTORIES = 9;
|
|
17
13
|
this.DOC_LEVEL_MAX_FILES = 9;
|
|
18
14
|
this.REQUIRED_PATHS = Object.freeze([
|
package/src/Validate/Service.mjs
CHANGED
|
@@ -5,14 +5,6 @@
|
|
|
5
5
|
* @description Validates baseline ADSM context structure, metadata, and documentation projection shape.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
const REQUIRED_SKIN_SECTIONS = Object.freeze([
|
|
9
|
-
"Purpose",
|
|
10
|
-
"Mental Model",
|
|
11
|
-
"Scope",
|
|
12
|
-
"Invariants",
|
|
13
|
-
"Agent Document",
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
8
|
const LINK_PATTERN = /\[[^\]]+\]\(([^)]+)\)/g;
|
|
17
9
|
const EXPLICIT_SKIN_FILENAME = /^(.*)\.skin\.([a-z]{2}(?:-[A-Za-z0-9]+)?)\.md$/;
|
|
18
10
|
const LEGACY_SKIN_FILENAME = /^(.*)\.skin\.md$/;
|
|
@@ -586,129 +578,9 @@ function validateSkinDocument({bodySet, constants, file, skinInfo, text}) {
|
|
|
586
578
|
severity: "error",
|
|
587
579
|
}));
|
|
588
580
|
}
|
|
589
|
-
const headings = extractLevelTwoHeadings(text);
|
|
590
|
-
for (const section of REQUIRED_SKIN_SECTIONS) {
|
|
591
|
-
if (!headings.includes(section)) {
|
|
592
|
-
findings.push(createFinding({
|
|
593
|
-
message: `Missing skin section "${section}": ${file}`,
|
|
594
|
-
path: file,
|
|
595
|
-
ruleId: "skin-required-sections",
|
|
596
|
-
severity: "error",
|
|
597
|
-
}));
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
const scopeText = extractSectionBody({sectionName: "Scope", text});
|
|
602
|
-
if (scopeText) {
|
|
603
|
-
if (!/^Includes:\s*$/m.test(scopeText)) {
|
|
604
|
-
findings.push(createFinding({
|
|
605
|
-
message: `Missing Includes: block in Scope: ${file}`,
|
|
606
|
-
path: file,
|
|
607
|
-
ruleId: "skin-scope-includes-excludes",
|
|
608
|
-
severity: "error",
|
|
609
|
-
}));
|
|
610
|
-
}
|
|
611
|
-
if (!/^Excludes:\s*$/m.test(scopeText)) {
|
|
612
|
-
findings.push(createFinding({
|
|
613
|
-
message: `Missing Excludes: block in Scope: ${file}`,
|
|
614
|
-
path: file,
|
|
615
|
-
ruleId: "skin-scope-includes-excludes",
|
|
616
|
-
severity: "error",
|
|
617
|
-
}));
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
const declaredReference = extractAgentDocumentReference(text);
|
|
622
|
-
if (!declaredReference) {
|
|
623
|
-
findings.push(createFinding({
|
|
624
|
-
message: `Missing Agent Document reference: ${file}`,
|
|
625
|
-
path: file,
|
|
626
|
-
ruleId: "skin-agent-document-reference",
|
|
627
|
-
severity: "error",
|
|
628
|
-
}));
|
|
629
|
-
findings.push(...validateSkinMetrics({constants, file, text}));
|
|
630
|
-
return findings;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
const expectedReference = skinInfo.body;
|
|
634
|
-
const normalizedReference = normalizeAgentDocumentReference({reference: declaredReference, skinFile: file});
|
|
635
|
-
if (normalizedReference !== expectedReference) {
|
|
636
|
-
findings.push(createFinding({
|
|
637
|
-
message: `Skin agent document mismatch: ${file} references ${normalizedReference} but expected ${expectedReference}`,
|
|
638
|
-
path: file,
|
|
639
|
-
ruleId: "skin-agent-document-reference",
|
|
640
|
-
severity: "error",
|
|
641
|
-
}));
|
|
642
|
-
}
|
|
643
|
-
if (!bodySet.has(normalizedReference)) {
|
|
644
|
-
findings.push(createFinding({
|
|
645
|
-
message: `Missing paired agent document: ${file} references ${normalizedReference}`,
|
|
646
|
-
path: file,
|
|
647
|
-
ruleId: "skin-paired-agent-document",
|
|
648
|
-
severity: "error",
|
|
649
|
-
}));
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
findings.push(...validateSkinMetrics({constants, file, text}));
|
|
653
581
|
return findings;
|
|
654
582
|
}
|
|
655
583
|
|
|
656
|
-
/**
|
|
657
|
-
* @param {object} params
|
|
658
|
-
* @param {Fl32_Skill_Adsm_Ctx_Shared_Constants} params.constants
|
|
659
|
-
* @param {string} params.file
|
|
660
|
-
* @param {string} params.text
|
|
661
|
-
* @returns {{message: string, path: string, ruleId: string, severity: "error" | "warning"}[]}
|
|
662
|
-
*/
|
|
663
|
-
function validateSkinMetrics({constants, file, text}) {
|
|
664
|
-
const findings = [];
|
|
665
|
-
const metricText = extractSkinMetricText(text);
|
|
666
|
-
const wordCount = countWords(metricText);
|
|
667
|
-
const listCount = countMeaningfulListItems(metricText);
|
|
668
|
-
|
|
669
|
-
if (wordCount > constants.SKIN_WORD_ERROR) {
|
|
670
|
-
findings.push(createFinding({
|
|
671
|
-
message: `Skin word count ${wordCount} exceeds limit ${constants.SKIN_WORD_ERROR}`,
|
|
672
|
-
path: file,
|
|
673
|
-
ruleId: "skin-size-word-count",
|
|
674
|
-
severity: "error",
|
|
675
|
-
}));
|
|
676
|
-
} else if (wordCount > constants.SKIN_WORD_WARN) {
|
|
677
|
-
findings.push(createFinding({
|
|
678
|
-
message: `Skin word count ${wordCount} exceeds warning threshold ${constants.SKIN_WORD_WARN}`,
|
|
679
|
-
path: file,
|
|
680
|
-
ruleId: "skin-size-word-count",
|
|
681
|
-
severity: "warning",
|
|
682
|
-
}));
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
if (listCount > constants.SKIN_LIST_ERROR) {
|
|
686
|
-
findings.push(createFinding({
|
|
687
|
-
message: `Skin list count ${listCount} exceeds limit ${constants.SKIN_LIST_ERROR}`,
|
|
688
|
-
path: file,
|
|
689
|
-
ruleId: "skin-size-list-count",
|
|
690
|
-
severity: "error",
|
|
691
|
-
}));
|
|
692
|
-
} else if (listCount > constants.SKIN_LIST_WARN) {
|
|
693
|
-
findings.push(createFinding({
|
|
694
|
-
message: `Skin list count ${listCount} exceeds warning threshold ${constants.SKIN_LIST_WARN}`,
|
|
695
|
-
path: file,
|
|
696
|
-
ruleId: "skin-size-list-count",
|
|
697
|
-
severity: "warning",
|
|
698
|
-
}));
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
return findings;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
* @param {string} text
|
|
706
|
-
* @returns {string[]}
|
|
707
|
-
*/
|
|
708
|
-
function extractLevelTwoHeadings(text) {
|
|
709
|
-
return [...text.matchAll(/^##\s+(.+)$/gm)].map((match) => match[1].trim());
|
|
710
|
-
}
|
|
711
|
-
|
|
712
584
|
/**
|
|
713
585
|
* @param {object} params
|
|
714
586
|
* @param {string} params.sectionName
|
|
@@ -731,46 +603,6 @@ function extractSectionBody({sectionName, text}) {
|
|
|
731
603
|
return body.join("\n");
|
|
732
604
|
}
|
|
733
605
|
|
|
734
|
-
/**
|
|
735
|
-
* @param {string} text
|
|
736
|
-
* @returns {string | null}
|
|
737
|
-
*/
|
|
738
|
-
function extractAgentDocumentReference(text) {
|
|
739
|
-
const lines = text.split("\n");
|
|
740
|
-
let insideSection = false;
|
|
741
|
-
for (const rawLine of lines) {
|
|
742
|
-
const line = rawLine.trim();
|
|
743
|
-
if (!insideSection) {
|
|
744
|
-
if (line === "## Agent Document") insideSection = true;
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
if (line.startsWith("## ")) break;
|
|
748
|
-
if (line.length > 0) return line;
|
|
749
|
-
}
|
|
750
|
-
return null;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
/**
|
|
754
|
-
* @param {object} params
|
|
755
|
-
* @param {string} params.reference
|
|
756
|
-
* @param {string} params.skinFile
|
|
757
|
-
* @returns {string}
|
|
758
|
-
*/
|
|
759
|
-
function normalizeAgentDocumentReference({reference, skinFile}) {
|
|
760
|
-
let value = reference.trim();
|
|
761
|
-
const codeMatch = value.match(/^`(.+)`$/);
|
|
762
|
-
if (codeMatch) value = codeMatch[1].trim();
|
|
763
|
-
const linkMatch = value.match(/^\[[^\]]+\]\(([^)]+)\)$/);
|
|
764
|
-
if (linkMatch) value = linkMatch[1].trim();
|
|
765
|
-
if (value.startsWith("./")) value = value.slice(2);
|
|
766
|
-
if (value.startsWith("ctx/docs/")) return value;
|
|
767
|
-
|
|
768
|
-
const skinParts = skinFile.split("/");
|
|
769
|
-
skinParts.pop();
|
|
770
|
-
skinParts.push(value);
|
|
771
|
-
return normalizeRelativeSegments(skinParts).join("/");
|
|
772
|
-
}
|
|
773
|
-
|
|
774
606
|
/**
|
|
775
607
|
* @param {object} params
|
|
776
608
|
* @param {string} params.file
|
|
@@ -827,18 +659,13 @@ function stripFencedCodeBlocks(text) {
|
|
|
827
659
|
}
|
|
828
660
|
|
|
829
661
|
/**
|
|
830
|
-
* Extracts
|
|
831
|
-
* Agent Document reference.
|
|
662
|
+
* Extracts all human-facing skin content while excluding metadata and headings.
|
|
832
663
|
*
|
|
833
664
|
* @param {string} text
|
|
834
665
|
* @returns {string}
|
|
835
666
|
*/
|
|
836
667
|
function extractSkinMetricText(text) {
|
|
837
|
-
return
|
|
838
|
-
.map((sectionName) => extractSectionBody({sectionName, text}))
|
|
839
|
-
.join("\n")
|
|
840
|
-
.replace(/^\s{0,3}#{1,6}\s+.*$/gm, "")
|
|
841
|
-
.replace(/^\s*(?:Includes|Excludes):\s*$/gm, "");
|
|
668
|
+
return stripSkinPresentation(text);
|
|
842
669
|
}
|
|
843
670
|
|
|
844
671
|
/**
|
|
@@ -846,11 +673,20 @@ function extractSkinMetricText(text) {
|
|
|
846
673
|
* @returns {string}
|
|
847
674
|
*/
|
|
848
675
|
function stripSkinPresentation(text) {
|
|
676
|
+
let insideLegacyReference = false;
|
|
849
677
|
return stripFencedCodeBlocks(text)
|
|
850
678
|
.split("\n")
|
|
851
|
-
.filter((line) =>
|
|
852
|
-
|
|
853
|
-
|
|
679
|
+
.filter((line) => {
|
|
680
|
+
const trimmed = line.trim();
|
|
681
|
+
if (/^##\s+Agent Document\s*$/.test(trimmed)) {
|
|
682
|
+
insideLegacyReference = true;
|
|
683
|
+
return false;
|
|
684
|
+
}
|
|
685
|
+
if (insideLegacyReference && /^##\s+/.test(trimmed)) insideLegacyReference = false;
|
|
686
|
+
return !insideLegacyReference && !/^#/.test(trimmed) && !/^- (?:Path|Changed): `[^`]+`$/.test(trimmed);
|
|
687
|
+
})
|
|
688
|
+
.join("\n")
|
|
689
|
+
.replace(/^\s*(?:Includes|Excludes):\s*$/gmu, "");
|
|
854
690
|
}
|
|
855
691
|
|
|
856
692
|
/**
|
package/types.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
type
|
|
3
|
-
type
|
|
2
|
+
type Fl32_Skill_Adsm_Ctx_Cli_Command_Design = import("./src/Cli/Command/Design.mjs").default;
|
|
3
|
+
type Fl32_Skill_Adsm_Ctx_Cli_Command_Init = import("./src/Cli/Command/Init.mjs").default;
|
|
4
|
+
type Fl32_Skill_Adsm_Ctx_Cli_Command_InstallSkill = import("./src/Cli/Command/InstallSkill.mjs").default;
|
|
5
|
+
type Fl32_Skill_Adsm_Ctx_Cli_Command_Upgrade = import("./src/Cli/Command/Upgrade.mjs").default;
|
|
6
|
+
type Fl32_Skill_Adsm_Ctx_Cli_Command_Validate = import("./src/Cli/Command/Validate.mjs").default;
|
|
4
7
|
type Fl32_Skill_Adsm_Ctx_Design_Service = import("./src/Design/Service.mjs").default;
|
|
5
8
|
type Fl32_Skill_Adsm_Ctx_Init_Service = import("./src/Init/Service.mjs").default;
|
|
6
9
|
type Fl32_Skill_Adsm_Ctx_Shared_Constants = import("./src/Shared/Constants.mjs").default;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
name: Upload Flows App Config
|
|
2
|
-
|
|
3
|
-
on: workflow_dispatch
|
|
4
|
-
|
|
5
|
-
env:
|
|
6
|
-
PRJ: flows-cfg-skill-adsm-ctx
|
|
7
|
-
CFG_SRC_DIR: ctx/agent/flows/cfg
|
|
8
|
-
CFG_ARCHIVE: flows-cfg-skill-adsm-ctx.tar.gz
|
|
9
|
-
CFG_TARGET_DIR: ${{ vars.FLOWS_CFG_DIR }}
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
upload:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
- name: Checkout repository
|
|
17
|
-
uses: actions/checkout@v5
|
|
18
|
-
|
|
19
|
-
- name: Validate source directory
|
|
20
|
-
run: |
|
|
21
|
-
set -e
|
|
22
|
-
|
|
23
|
-
if [ ! -d "${{ env.CFG_SRC_DIR }}" ]; then
|
|
24
|
-
echo "Source directory does not exist: ${{ env.CFG_SRC_DIR }}"
|
|
25
|
-
exit 1
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
find "${{ env.CFG_SRC_DIR }}" -mindepth 1 -print -quit | grep -q . || {
|
|
29
|
-
echo "Source directory is empty: ${{ env.CFG_SRC_DIR }}"
|
|
30
|
-
exit 1
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
- name: Build configuration archive
|
|
34
|
-
run: |
|
|
35
|
-
set -e
|
|
36
|
-
|
|
37
|
-
tar -C "${{ env.CFG_SRC_DIR }}" -czf "${{ env.CFG_ARCHIVE }}" .
|
|
38
|
-
|
|
39
|
-
ls -lh "${{ env.CFG_ARCHIVE }}"
|
|
40
|
-
|
|
41
|
-
- name: Copy archive to server
|
|
42
|
-
uses: appleboy/scp-action@master
|
|
43
|
-
with:
|
|
44
|
-
host: ${{ vars.FLOWS_HOST }}
|
|
45
|
-
username: ${{ vars.FLOWS_USER }}
|
|
46
|
-
key: ${{ secrets.FLOWS_SSH_KEY }}
|
|
47
|
-
source: ${{ env.CFG_ARCHIVE }}
|
|
48
|
-
target: /tmp
|
|
49
|
-
|
|
50
|
-
- name: Replace configuration on server
|
|
51
|
-
uses: appleboy/ssh-action@master
|
|
52
|
-
with:
|
|
53
|
-
host: ${{ vars.FLOWS_HOST }}
|
|
54
|
-
username: ${{ vars.FLOWS_USER }}
|
|
55
|
-
key: ${{ secrets.FLOWS_SSH_KEY }}
|
|
56
|
-
script: |
|
|
57
|
-
set -e
|
|
58
|
-
|
|
59
|
-
TARGET_DIR="${{ env.CFG_TARGET_DIR }}"
|
|
60
|
-
ARCHIVE="/tmp/${{ env.CFG_ARCHIVE }}"
|
|
61
|
-
|
|
62
|
-
if [ -z "$TARGET_DIR" ]; then
|
|
63
|
-
echo "CFG_TARGET_DIR is empty."
|
|
64
|
-
exit 1
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
if [ "$TARGET_DIR" = "/" ]; then
|
|
68
|
-
echo "Refusing to replace root directory."
|
|
69
|
-
exit 1
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
if [ ! -f "$ARCHIVE" ]; then
|
|
73
|
-
echo "Archive does not exist: $ARCHIVE"
|
|
74
|
-
exit 1
|
|
75
|
-
fi
|
|
76
|
-
|
|
77
|
-
PARENT_DIR="$(dirname "$TARGET_DIR")"
|
|
78
|
-
TARGET_NAME="$(basename "$TARGET_DIR")"
|
|
79
|
-
TIMESTAMP="$(date +%Y%m%d-%H%M%S)"
|
|
80
|
-
STAGING_DIR="$PARENT_DIR/.${TARGET_NAME}.new-$TIMESTAMP"
|
|
81
|
-
|
|
82
|
-
mkdir -p "$PARENT_DIR"
|
|
83
|
-
|
|
84
|
-
rm -rf "$STAGING_DIR"
|
|
85
|
-
mkdir -p "$STAGING_DIR"
|
|
86
|
-
|
|
87
|
-
tar -xzf "$ARCHIVE" -C "$STAGING_DIR"
|
|
88
|
-
|
|
89
|
-
rm -rf "$TARGET_DIR"
|
|
90
|
-
mv "$STAGING_DIR" "$TARGET_DIR"
|
|
91
|
-
|
|
92
|
-
rm -f "$ARCHIVE"
|
|
93
|
-
|
|
94
|
-
echo "Configuration uploaded to: $TARGET_DIR"
|
|
95
|
-
find "$TARGET_DIR" -maxdepth 3 -type f | sort
|
package/AGENTS.md
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
# Root Level
|
|
2
|
-
|
|
3
|
-
- Path: `AGENTS.md`
|
|
4
|
-
- Template Version: `20260702`
|
|
5
|
-
- Changed: `20260702`
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
This file defines the root-level working rules for the project repository.
|
|
10
|
-
|
|
11
|
-
This file is the first instruction source for every agent operating within the repository.
|
|
12
|
-
|
|
13
|
-
## Level Boundary
|
|
14
|
-
|
|
15
|
-
Defines:
|
|
16
|
-
|
|
17
|
-
- Root-level working boundaries between the repository, the cognitive context, and the software product.
|
|
18
|
-
- Repository-topology rules needed to work safely when `ctx/` may be mounted separately.
|
|
19
|
-
- Root-level protection and escalation rules for this project.
|
|
20
|
-
|
|
21
|
-
Does NOT define:
|
|
22
|
-
|
|
23
|
-
- Product-specific meaning, requirements, or domain knowledge.
|
|
24
|
-
- Implementation-level structure such as source code, runtime details, or filesystem layout.
|
|
25
|
-
- Task-specific instructions, workflows, or local operational procedures.
|
|
26
|
-
|
|
27
|
-
## ADSM Project Model
|
|
28
|
-
|
|
29
|
-
An ADSM project consists of two interconnected spaces:
|
|
30
|
-
|
|
31
|
-
- the **Cognitive Context** located in `./ctx/`
|
|
32
|
-
- the **Software Product** located outside `./ctx/`
|
|
33
|
-
|
|
34
|
-
The cognitive context is the long-term textual memory of the project.
|
|
35
|
-
|
|
36
|
-
The cognitive context is the primary communication medium between Humans and Agents working on the project.
|
|
37
|
-
|
|
38
|
-
The cognitive context is the authoritative knowledge source used by Agents when modifying the project.
|
|
39
|
-
|
|
40
|
-
The software product is the implementation that must be kept consistent with the cognitive context.
|
|
41
|
-
|
|
42
|
-
## Human and Agent Roles
|
|
43
|
-
|
|
44
|
-
The Human defines goals, authorizes work, evaluates outcomes, and evolves the project.
|
|
45
|
-
|
|
46
|
-
The Agent interprets the cognitive context, performs assigned tasks, modifies the project within task boundaries, and maintains consistency between the cognitive context and the software product.
|
|
47
|
-
|
|
48
|
-
The Agent operates through text and must treat project documentation as operational memory, not as secondary commentary.
|
|
49
|
-
|
|
50
|
-
## Cognitive Context
|
|
51
|
-
|
|
52
|
-
The canonical execution location of the cognitive context is `./ctx/`.
|
|
53
|
-
|
|
54
|
-
Project-specific knowledge, requirements, architecture, environment descriptions, and implementation guidance are defined within the cognitive context.
|
|
55
|
-
|
|
56
|
-
The Agent must consult `./ctx/AGENTS.md` for project-specific instructions when `./ctx/` exists.
|
|
57
|
-
|
|
58
|
-
The Agent must consult `./ctx/docs/filesystem.md` for the project filesystem structure and documentation layout when that file exists.
|
|
59
|
-
|
|
60
|
-
Documentation distributed with the software product may exist outside `./ctx/`, but it does not replace, redefine, or supersede the cognitive context.
|
|
61
|
-
|
|
62
|
-
## Bootstrap and Repository Topology
|
|
63
|
-
|
|
64
|
-
An ADSM project may use one repository or two repositories.
|
|
65
|
-
|
|
66
|
-
In a one-repository topology, the software product and the cognitive context are versioned together.
|
|
67
|
-
|
|
68
|
-
In a two-repository topology, the software product and the cognitive context are independent version-controlled repositories, and the cognitive context repository is mounted under `./ctx/`.
|
|
69
|
-
|
|
70
|
-
The Agent must detect whether `./ctx/` is part of the current repository or an independent repository.
|
|
71
|
-
|
|
72
|
-
The Agent must preserve repository boundaries.
|
|
73
|
-
|
|
74
|
-
The Agent must not mix changes between independent repositories.
|
|
75
|
-
|
|
76
|
-
The Agent must not remove, replace, relocate, or unmount `./ctx/`.
|
|
77
|
-
|
|
78
|
-
If `./ctx/` does not exist, the Agent may perform bootstrap operations required to create the initial cognitive context structure.
|
|
79
|
-
|
|
80
|
-
After bootstrap is complete, `./ctx/AGENTS.md` becomes the entry point for project-specific instructions.
|
|
81
|
-
|
|
82
|
-
## Context and Product Consistency
|
|
83
|
-
|
|
84
|
-
The cognitive context is the source of truth for the project.
|
|
85
|
-
|
|
86
|
-
If the cognitive context and the software product diverge, the Agent must treat the cognitive context as authoritative.
|
|
87
|
-
|
|
88
|
-
The Agent must maintain consistency between the cognitive context and the software product.
|
|
89
|
-
|
|
90
|
-
The Agent may modify the cognitive context when required by the assigned task and when the modification remains consistent with higher-level context constraints.
|
|
91
|
-
|
|
92
|
-
The Agent may modify the software product when required by the assigned task and when the modification remains consistent with the cognitive context.
|
|
93
|
-
|
|
94
|
-
## AGENTS.md Hierarchy
|
|
95
|
-
|
|
96
|
-
Additional `AGENTS.md` files may exist in subdirectories.
|
|
97
|
-
|
|
98
|
-
The effective working context of the agent is the aggregate of all `AGENTS.md` files located along the path from the repository root to the target directory.
|
|
99
|
-
|
|
100
|
-
Rules:
|
|
101
|
-
|
|
102
|
-
- deeper levels override higher levels within their scope
|
|
103
|
-
- root-level invariants cannot be overridden
|
|
104
|
-
- all levels must remain mutually consistent
|
|
105
|
-
|
|
106
|
-
## Root File Protection
|
|
107
|
-
|
|
108
|
-
This file defines root-level project control rules.
|
|
109
|
-
|
|
110
|
-
The agent must not modify, replace, delete, relocate, or reinterpret this file unless explicitly instructed by the human.
|
|
111
|
-
|
|
112
|
-
Violation of this rule constitutes an execution error.
|
package/bin/cli.mjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from "node:fs/promises";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import processModule from "node:process";
|
|
6
|
-
import {fileURLToPath} from "node:url";
|
|
7
|
-
|
|
8
|
-
import Container from "@teqfw/di/src/Container.mjs";
|
|
9
|
-
import NamespaceRegistry from "@teqfw/di/src/Config/NamespaceRegistry.mjs";
|
|
10
|
-
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = path.dirname(__filename);
|
|
13
|
-
const packageRoot = path.resolve(__dirname, "..");
|
|
14
|
-
const projectRoot = processModule.cwd();
|
|
15
|
-
|
|
16
|
-
const container = new Container();
|
|
17
|
-
const namespaceRegistry = new NamespaceRegistry({fs, path, appRoot: packageRoot});
|
|
18
|
-
const entries = await namespaceRegistry.build();
|
|
19
|
-
|
|
20
|
-
for (const entry of entries) {
|
|
21
|
-
container.addNamespaceRoot(entry.prefix, entry.dirAbs, entry.ext);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const cliArgs = processModule.argv.slice(2);
|
|
25
|
-
const app = await container.get("Fl32_Skill_Adsm_Ctx_Bootstrap$");
|
|
26
|
-
|
|
27
|
-
let exitCode = 1;
|
|
28
|
-
let stopRequested = false;
|
|
29
|
-
|
|
30
|
-
const stopApp = async function () {
|
|
31
|
-
if (stopRequested) return;
|
|
32
|
-
stopRequested = true;
|
|
33
|
-
try {
|
|
34
|
-
await app.stop();
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error(error);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
41
|
-
processModule.once(signal, () => {
|
|
42
|
-
void stopApp();
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
exitCode = await app.run({projectRoot, cliArgs});
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error(error);
|
|
50
|
-
exitCode = 1;
|
|
51
|
-
} finally {
|
|
52
|
-
await stopApp();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
processModule.exit(typeof exitCode === "number" ? exitCode : 1);
|
package/ctx/AGENTS.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Cognitive Context
|
|
2
|
-
|
|
3
|
-
- Path: `ctx/AGENTS.md`
|
|
4
|
-
- Template Version: `20260702`
|
|
5
|
-
- Changed: `20260707`
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
This file marks `ctx/` as the project cognitive context.
|
|
10
|
-
|
|
11
|
-
Use this branch for project knowledge and keep detailed ADSM methodology outside the project-facing context.
|
|
12
|
-
|
|
13
|
-
## Bootstrap Marker
|
|
14
|
-
|
|
15
|
-
- This context follows ADSM conventions.
|
|
16
|
-
- Use skill `adsm-ctx` for structure validation, upgrade logic, and methodology rules.
|
|
17
|
-
|
|
18
|
-
## Level Map
|
|
19
|
-
|
|
20
|
-
- `agent/` — project-local agent and tool materials outside the reusable ADSM baseline.
|
|
21
|
-
- `assets/` — visual, generated, rendered, or auxiliary artifacts that support documentation without defining authoritative meaning.
|
|
22
|
-
- `docs/` — project-facing documentation and constraints.
|
|
23
|
-
- `AGENTS.md` — level definition for `ctx/`.
|
|
24
|
-
- `README.md` — short entry note for the cognitive context.
|
|
25
|
-
- `adsm.json` — context metadata for versioning and upgrade eligibility.
|
|
26
|
-
|
|
27
|
-
## Level Boundary
|
|
28
|
-
|
|
29
|
-
Defines:
|
|
30
|
-
|
|
31
|
-
- `ctx/` as the project cognitive context boundary.
|
|
32
|
-
- The split between project-facing documentation and project-local agent materials.
|
|
33
|
-
- The local entry points agents should read before deeper work.
|
|
34
|
-
|
|
35
|
-
Does NOT define:
|
|
36
|
-
|
|
37
|
-
- Product-specific meaning that belongs in subordinate product and architecture documents.
|
|
38
|
-
- Implementation structure outside the cognitive context.
|
|
39
|
-
- Detailed ADSM methodology that belongs to the skill and its references.
|
|
40
|
-
|
|
41
|
-
## Local Reading Map
|
|
42
|
-
|
|
43
|
-
- Read `README.md` for a short entry note.
|
|
44
|
-
- Read `docs/filesystem.md` for the top-level repository map.
|
package/ctx/README.md
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Cognitive Context
|
|
2
|
-
|
|
3
|
-
- Path: `ctx/README.md`
|
|
4
|
-
- Template Version: `20260623`
|
|
5
|
-
- Changed: `20260702`
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
This directory contains the project cognitive context.
|
|
10
|
-
|
|
11
|
-
The cognitive context is the authoritative project knowledge space used by humans and agents when maintaining the project.
|
|
12
|
-
|
|
13
|
-
## Entry Points
|
|
14
|
-
|
|
15
|
-
- Read `AGENTS.md` for cognitive-context structure and governance rules.
|
|
16
|
-
- Read `docs/filesystem.md` for the top-level repository map.
|
|
17
|
-
- Read `docs/` for declarative project documentation.
|
|
18
|
-
- Read `agent/` only when working with repository-local agent operations or workflow assets.
|
|
19
|
-
|
|
20
|
-
## Boundary
|
|
21
|
-
|
|
22
|
-
This directory defines project knowledge and agent-operational context.
|
|
23
|
-
|
|
24
|
-
It does not replace product source code, runtime configuration, deployment secrets, or generated build artifacts.
|
package/ctx/adsm.json
DELETED
package/ctx/agent/AGENTS.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Agent External Context
|
|
2
|
-
|
|
3
|
-
- Path: `ctx/agent/AGENTS.md`
|
|
4
|
-
- Changed: `20260707`
|
|
5
|
-
|
|
6
|
-
## Purpose
|
|
7
|
-
|
|
8
|
-
Defines the boundary of `ctx/agent/` for this repository.
|
|
9
|
-
|
|
10
|
-
This branch is reserved for materials that document relationships, routines, and tool-facing instructions that sit outside ADSM methodology.
|
|
11
|
-
|
|
12
|
-
Only this file belongs to the ADSM template baseline for `ctx/agent/`.
|
|
13
|
-
|
|
14
|
-
Humans and agents may create project-local subdirectories here when they need instructions or records tied to a concrete tool or relationship, such as `github-flows`.
|
|
15
|
-
|
|
16
|
-
## Level Map
|
|
17
|
-
|
|
18
|
-
- `flows/` — operational workflow documentation and configuration for repository automation driven by labels and GitHub events.
|
|
19
|
-
- `prompt/` — prompt definitions used by agents when generating or maintaining repository-facing context artifacts.
|
|
20
|
-
- `report/` — task-specific agent reports produced during repository-local analysis or maintenance work.
|
|
21
|
-
- `AGENTS.md` — level definition for `ctx/agent/`.
|
|
22
|
-
|
|
23
|
-
## Level Boundary
|
|
24
|
-
|
|
25
|
-
Defines:
|
|
26
|
-
|
|
27
|
-
- The reserved role of `ctx/agent/` as a repository-local branch outside ADSM methodology.
|
|
28
|
-
- The boundary between ADSM-governed context and project-local agent or tool materials.
|
|
29
|
-
- The rule that only `ctx/agent/AGENTS.md` is part of the template-managed baseline for this branch.
|
|
30
|
-
|
|
31
|
-
Does NOT define:
|
|
32
|
-
|
|
33
|
-
- Product meaning, domain scope, or user-facing requirements.
|
|
34
|
-
- Architecture ownership, system structure, or product-level engineering constraints.
|
|
35
|
-
- The required shape of project-local subdirectories created for concrete tools or relationships.
|
|
36
|
-
|
|
37
|
-
## Operational Constraints
|
|
38
|
-
|
|
39
|
-
- Materials placed under project-local subdirectories in `ctx/agent/` remain outside ADSM methodology unless a higher-level context document explicitly says otherwise.
|
|
40
|
-
- Tool-specific instructions under this branch must stay consistent with authoritative constraints in `ctx/docs/`.
|
|
41
|
-
- Changes that alter agent authority or escalation expectations must remain consistent with `ctx/docs/architecture/supervision.md`.
|
|
Binary file
|