@flancer32/skill-adsm-ctx 0.2.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.
- package/.github/workflows/flows-app.yaml +95 -0
- package/AGENTS.md +112 -0
- package/LICENSE +201 -0
- package/README.md +246 -0
- package/bin/cli.mjs +55 -0
- package/ctx/AGENTS.md +44 -0
- package/ctx/README.md +24 -0
- package/ctx/adsm.json +5 -0
- package/ctx/agent/AGENTS.md +41 -0
- package/ctx/agent/flows/.img/flancer32-skill-adsm-ctx-github-flows.png +0 -0
- package/ctx/agent/flows/AGENTS.md +37 -0
- package/ctx/agent/flows/cfg/issues/labeled/accepted/profile.json +25 -0
- package/ctx/agent/flows/cfg/issues/labeled/accepted/prompt.md +104 -0
- package/ctx/agent/flows/cfg/issues/labeled/clarification-provided/profile.json +15 -0
- package/ctx/agent/flows/cfg/issues/labeled/clarification-provided/prompt.md +63 -0
- package/ctx/agent/flows/cfg/issues/opened/admission/profile.json +14 -0
- package/ctx/agent/flows/cfg/issues/opened/admission/prompt.md +110 -0
- package/ctx/agent/flows/cfg/profile.json +40 -0
- package/ctx/agent/flows/cfg/pull_request/closed/merged/profile.json +15 -0
- package/ctx/agent/flows/cfg/pull_request/closed/merged/prompt.md +41 -0
- package/ctx/agent/flows/cfg/pull_request/labeled/needs-fix/profile.json +25 -0
- package/ctx/agent/flows/cfg/pull_request/labeled/needs-fix/prompt.md +79 -0
- package/ctx/agent/flows/cfg/pull_request/labeled/ready-for-validation/profile.json +15 -0
- package/ctx/agent/flows/cfg/pull_request/labeled/ready-for-validation/prompt.md +72 -0
- package/ctx/agent/flows/cfg/pull_request/labeled/verified/profile.json +15 -0
- package/ctx/agent/flows/cfg/pull_request/labeled/verified/prompt.md +48 -0
- package/ctx/agent/flows/deployment.md +116 -0
- package/ctx/agent/flows/labels.md +108 -0
- package/ctx/agent/flows/overview.md +82 -0
- package/ctx/agent/prompt/cli/ai-intro.md +141 -0
- package/ctx/assets/.gitkeep +1 -0
- package/ctx/docs/AGENTS.md +121 -0
- package/ctx/docs/ai-intro.md +37 -0
- package/ctx/docs/architecture/AGENTS.md +98 -0
- package/ctx/docs/architecture/behavior.md +68 -0
- package/ctx/docs/architecture/checklists.md +48 -0
- package/ctx/docs/architecture/constraints.md +53 -0
- package/ctx/docs/architecture/constraints.skin.en.md +38 -0
- package/ctx/docs/architecture/decisions.md +118 -0
- package/ctx/docs/architecture/integration.md +31 -0
- package/ctx/docs/architecture/overview.md +76 -0
- package/ctx/docs/architecture/state.md +50 -0
- package/ctx/docs/architecture/structure.md +38 -0
- package/ctx/docs/architecture/supervision.md +71 -0
- package/ctx/docs/code/AGENTS.md +51 -0
- package/ctx/docs/code/overview.md +53 -0
- package/ctx/docs/code/testing.md +26 -0
- package/ctx/docs/environment/AGENTS.md +50 -0
- package/ctx/docs/environment/overview.md +33 -0
- package/ctx/docs/filesystem.md +44 -0
- package/ctx/docs/product/AGENTS.md +51 -0
- package/ctx/docs/product/domain.md +63 -0
- package/ctx/docs/product/domain.skin.en.md +40 -0
- package/ctx/docs/product/glossary.md +31 -0
- package/ctx/docs/product/overview.md +112 -0
- package/ctx/docs/product/overview.skin.en.md +38 -0
- package/ctx/docs/product/roles.md +17 -0
- package/ctx/docs/product/use-cases.md +15 -0
- package/jsconfig.json +12 -0
- package/migrations/README.md +9 -0
- package/package.json +33 -0
- package/skill/SKILL.md +47 -0
- package/skill/references/agents-hierarchy.md +45 -0
- package/skill/references/context-lifecycle.md +53 -0
- package/skill/references/design-questionnaire.md +44 -0
- package/skill/references/document-projections.md +290 -0
- package/skill/references/documentation-compression.md +117 -0
- package/skill/references/documentation-quality-audit.md +199 -0
- package/skill/references/orchestration-model.md +41 -0
- package/skill/references/specialized-skills.md +31 -0
- package/skill/references/upgrade-policy.md +19 -0
- package/skill/templates/AGENTS.md +120 -0
- package/skill/templates/ai/AGENTS.md +59 -0
- package/skill/templates/ctx/AGENTS.md +45 -0
- package/skill/templates/ctx/README.md +27 -0
- package/skill/templates/ctx/adsm.json +7 -0
- package/skill/templates/ctx/agent/AGENTS.md +36 -0
- package/skill/templates/ctx/assets/.gitkeep +1 -0
- package/skill/templates/ctx/docs/AGENTS.md +55 -0
- package/skill/templates/ctx/docs/ai-intro.md +53 -0
- package/skill/templates/ctx/docs/architecture/AGENTS.md +42 -0
- package/skill/templates/ctx/docs/architecture/behavior.md +38 -0
- package/skill/templates/ctx/docs/architecture/checklists.md +25 -0
- package/skill/templates/ctx/docs/architecture/constraints.md +36 -0
- package/skill/templates/ctx/docs/architecture/decisions.md +33 -0
- package/skill/templates/ctx/docs/architecture/integration.md +27 -0
- package/skill/templates/ctx/docs/architecture/overview.md +73 -0
- package/skill/templates/ctx/docs/architecture/state.md +52 -0
- package/skill/templates/ctx/docs/architecture/structure.md +32 -0
- package/skill/templates/ctx/docs/architecture/supervision.md +61 -0
- package/skill/templates/ctx/docs/code/AGENTS.md +35 -0
- package/skill/templates/ctx/docs/code/overview.md +21 -0
- package/skill/templates/ctx/docs/code/testing.md +13 -0
- package/skill/templates/ctx/docs/environment/AGENTS.md +34 -0
- package/skill/templates/ctx/docs/environment/overview.md +21 -0
- package/skill/templates/ctx/docs/filesystem.md +39 -0
- package/skill/templates/ctx/docs/product/AGENTS.md +38 -0
- package/skill/templates/ctx/docs/product/domain.md +77 -0
- package/skill/templates/ctx/docs/product/glossary.md +110 -0
- package/skill/templates/ctx/docs/product/overview.md +74 -0
- package/skill/templates/ctx/docs/product/roles.md +100 -0
- package/skill/templates/ctx/docs/product/use-cases.md +109 -0
- package/skill/templates/work/context/semantic-skin.md +27 -0
- package/skill/templates/work/report/documentation-compression.md +34 -0
- package/skill/templates/work/report/documentation-quality-audit.md +90 -0
- package/src/Bootstrap/Cli.mjs +62 -0
- package/src/Bootstrap.mjs +108 -0
- package/src/Design/Service.mjs +36 -0
- package/src/Init/Service.mjs +136 -0
- package/src/Shared/Constants.mjs +36 -0
- package/src/Shared/CopyDirectory.mjs +78 -0
- package/src/Shared/Metadata.mjs +30 -0
- package/src/Shared/Path.mjs +38 -0
- package/src/Skill/Installer.mjs +47 -0
- package/src/Upgrade/Service.mjs +44 -0
- package/src/Validate/Service.mjs +879 -0
- package/test/integration/.gitkeep +1 -0
- package/test/integration/cli-help.test.mjs +15 -0
- package/test/integration/cli-init-validate.test.mjs +223 -0
- package/test/integration/cli-install-skill.test.mjs +41 -0
- package/test/unit/Bootstrap/Cli.test.mjs +23 -0
- package/test/unit/Bootstrap.test.mjs +53 -0
- package/test/unit/Design/Service.test.mjs +11 -0
- package/test/unit/Init/Service.test.mjs +51 -0
- package/test/unit/Shared/Constants.test.mjs +21 -0
- package/test/unit/Shared/CopyDirectory.test.mjs +31 -0
- package/test/unit/Shared/Metadata.test.mjs +9 -0
- package/test/unit/Shared/Path.test.mjs +11 -0
- package/test/unit/Skill/Installer.test.mjs +20 -0
- package/test/unit/Upgrade/Service.test.mjs +13 -0
- package/test/unit/Validate/Service.test.mjs +760 -0
- package/types.d.ts +15 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @namespace Fl32_Skill_Adsm_Ctx_Init_Service
|
|
5
|
+
* @description Initializes the baseline ADSM context structure in a target project directory.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const templateRoot = new URL("../../skill/templates/ctx/", import.meta.url);
|
|
9
|
+
const rootAgentsTemplate = [
|
|
10
|
+
"# Root Level",
|
|
11
|
+
"",
|
|
12
|
+
"- Path: `AGENTS.md`",
|
|
13
|
+
"- Changed: `20260702`",
|
|
14
|
+
"",
|
|
15
|
+
"## Purpose",
|
|
16
|
+
"",
|
|
17
|
+
"Marks the repository root and points agents to the project cognitive context in `ctx/`.",
|
|
18
|
+
"",
|
|
19
|
+
"## Bootstrap Exception",
|
|
20
|
+
"",
|
|
21
|
+
"- `init` and other bootstrap operations may create the initial `ctx/` structure when it does not exist yet.",
|
|
22
|
+
"- This repository uses an ADSM-managed cognitive context.",
|
|
23
|
+
"- Use skill `adsm-ctx` for context validation, upgrades, and methodology rules.",
|
|
24
|
+
"",
|
|
25
|
+
"## Cognitive Context Entry",
|
|
26
|
+
"",
|
|
27
|
+
"- Read `ctx/AGENTS.md` before modifying project files after the context exists.",
|
|
28
|
+
"- Treat `ctx/` as the source of truth for project context after bootstrap is complete.",
|
|
29
|
+
"",
|
|
30
|
+
].join("\n");
|
|
31
|
+
|
|
32
|
+
export default class Service {
|
|
33
|
+
/**
|
|
34
|
+
* @param {object} deps
|
|
35
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_CopyDirectory} deps.copyDirectory
|
|
36
|
+
* @param {typeof import("node:fs")} deps.fs
|
|
37
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Metadata} deps.metadata
|
|
38
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Path} deps.pathService
|
|
39
|
+
* @param {typeof import("node:url")} deps.url
|
|
40
|
+
*/
|
|
41
|
+
constructor({copyDirectory, fs, metadata, pathService, url}) {
|
|
42
|
+
/**
|
|
43
|
+
* Creates baseline context structure in the target project.
|
|
44
|
+
*
|
|
45
|
+
* @param {object} params
|
|
46
|
+
* @param {string} params.targetPath
|
|
47
|
+
* @returns {Promise<{created: string[], ctxRoot: string, projectRoot: string, skipped: string[]}>}
|
|
48
|
+
*/
|
|
49
|
+
this.execute = async function ({targetPath}) {
|
|
50
|
+
const projectRoot = pathService.resolve(targetPath);
|
|
51
|
+
const ctxRoot = pathService.join(projectRoot, "ctx");
|
|
52
|
+
const created = [];
|
|
53
|
+
const skipped = [];
|
|
54
|
+
|
|
55
|
+
fs.mkdirSync(projectRoot, {recursive: true});
|
|
56
|
+
copyDirectory.copyMissing({
|
|
57
|
+
sourcePath: url.fileURLToPath(templateRoot),
|
|
58
|
+
targetPath: ctxRoot,
|
|
59
|
+
created,
|
|
60
|
+
pathPrefix: "ctx",
|
|
61
|
+
skipped,
|
|
62
|
+
});
|
|
63
|
+
stampCreatedMarkdownDates({created, fs, pathService, projectRoot});
|
|
64
|
+
ensureRootAgents({created, fs, pathService, projectRoot, skipped});
|
|
65
|
+
writeMetadata({created, fs, metadata, pathService, projectRoot, skipped});
|
|
66
|
+
|
|
67
|
+
return {created, ctxRoot, projectRoot, skipped};
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @param {object} params
|
|
74
|
+
* @param {string[]} params.created
|
|
75
|
+
* @param {typeof import("node:fs")} params.fs
|
|
76
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Path} params.pathService
|
|
77
|
+
* @param {string} params.projectRoot
|
|
78
|
+
* @param {string[]} params.skipped
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
function ensureRootAgents({created, fs, pathService, projectRoot, skipped}) {
|
|
82
|
+
const filePath = pathService.join(projectRoot, "AGENTS.md");
|
|
83
|
+
if (!fs.existsSync(filePath)) {
|
|
84
|
+
fs.writeFileSync(filePath, rootAgentsTemplate);
|
|
85
|
+
created.push("AGENTS.md");
|
|
86
|
+
} else {
|
|
87
|
+
skipped.push("AGENTS.md");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {object} params
|
|
93
|
+
* @param {string[]} params.created
|
|
94
|
+
* @param {typeof import("node:fs")} params.fs
|
|
95
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Path} params.pathService
|
|
96
|
+
* @param {string} params.projectRoot
|
|
97
|
+
* @returns {void}
|
|
98
|
+
*/
|
|
99
|
+
function stampCreatedMarkdownDates({created, fs, pathService, projectRoot}) {
|
|
100
|
+
const currentDate = new Date().toISOString().slice(0, 10).replaceAll("-", "");
|
|
101
|
+
for (const entry of created) {
|
|
102
|
+
if (!entry.endsWith(".md")) continue;
|
|
103
|
+
const filePath = pathService.join(projectRoot, ...entry.split("/"));
|
|
104
|
+
const current = fs.readFileSync(filePath, "utf8");
|
|
105
|
+
const updated = current.replace(/- Changed: `YYYYMMDD`/g, `- Changed: \`${currentDate}\``);
|
|
106
|
+
if (updated !== current) fs.writeFileSync(filePath, updated);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {object} params
|
|
112
|
+
* @param {string[]} params.created
|
|
113
|
+
* @param {typeof import("node:fs")} params.fs
|
|
114
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Metadata} params.metadata
|
|
115
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Path} params.pathService
|
|
116
|
+
* @param {string} params.projectRoot
|
|
117
|
+
* @param {string[]} params.skipped
|
|
118
|
+
* @returns {void}
|
|
119
|
+
*/
|
|
120
|
+
function writeMetadata({created, fs, metadata, pathService, projectRoot, skipped}) {
|
|
121
|
+
const metadataPath = pathService.join(projectRoot, "ctx", "adsm.json");
|
|
122
|
+
if (!fs.existsSync(metadataPath)) {
|
|
123
|
+
fs.writeFileSync(metadataPath, `${JSON.stringify(metadata.create(), null, 2)}\n`);
|
|
124
|
+
created.push("ctx/adsm.json");
|
|
125
|
+
} else {
|
|
126
|
+
skipped.push("ctx/adsm.json");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const __deps__ = Object.freeze({
|
|
131
|
+
copyDirectory: "Fl32_Skill_Adsm_Ctx_Shared_CopyDirectory$",
|
|
132
|
+
fs: "node:fs",
|
|
133
|
+
metadata: "Fl32_Skill_Adsm_Ctx_Shared_Metadata$",
|
|
134
|
+
pathService: "Fl32_Skill_Adsm_Ctx_Shared_Path$",
|
|
135
|
+
url: "node:url",
|
|
136
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @namespace Fl32_Skill_Adsm_Ctx_Shared_Constants
|
|
5
|
+
* @description Publishes immutable baseline constants for the ADSM context lifecycle package.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export default class Constants {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.CONTEXT_SCHEMA = "adsm-context";
|
|
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
|
+
this.DOC_LEVEL_MAX_DIRECTORIES = 9;
|
|
17
|
+
this.DOC_LEVEL_MAX_FILES = 9;
|
|
18
|
+
this.REQUIRED_PATHS = Object.freeze([
|
|
19
|
+
"AGENTS.md",
|
|
20
|
+
"ctx",
|
|
21
|
+
"ctx/docs",
|
|
22
|
+
"ctx/docs/product",
|
|
23
|
+
"ctx/docs/architecture",
|
|
24
|
+
"ctx/docs/environment",
|
|
25
|
+
"ctx/docs/code",
|
|
26
|
+
"ctx/adsm.json",
|
|
27
|
+
"ctx/AGENTS.md",
|
|
28
|
+
"ctx/docs/AGENTS.md",
|
|
29
|
+
"ctx/docs/product/AGENTS.md",
|
|
30
|
+
"ctx/docs/architecture/AGENTS.md",
|
|
31
|
+
"ctx/docs/environment/AGENTS.md",
|
|
32
|
+
"ctx/docs/code/AGENTS.md",
|
|
33
|
+
]);
|
|
34
|
+
this.DOC_LEVELS = Object.freeze(["product", "architecture", "environment", "code"]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @namespace Fl32_Skill_Adsm_Ctx_Shared_CopyDirectory
|
|
5
|
+
* @description Recursively copies a directory tree using Node.js filesystem primitives.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export default class CopyDirectory {
|
|
9
|
+
/**
|
|
10
|
+
* @param {object} deps
|
|
11
|
+
* @param {typeof import("node:fs")} deps.fs
|
|
12
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Path} deps.pathService
|
|
13
|
+
*/
|
|
14
|
+
constructor({fs, pathService}) {
|
|
15
|
+
/**
|
|
16
|
+
* Copies a directory tree recursively.
|
|
17
|
+
*
|
|
18
|
+
* @param {object} params
|
|
19
|
+
* @param {string} params.sourcePath
|
|
20
|
+
* @param {string} params.targetPath
|
|
21
|
+
* @returns {void}
|
|
22
|
+
*/
|
|
23
|
+
this.execute = function ({sourcePath, targetPath}) {
|
|
24
|
+
fs.mkdirSync(targetPath, {recursive: true});
|
|
25
|
+
for (const entry of fs.readdirSync(sourcePath, {withFileTypes: true})) {
|
|
26
|
+
const sourceEntry = pathService.join(sourcePath, entry.name);
|
|
27
|
+
const targetEntry = pathService.join(targetPath, entry.name);
|
|
28
|
+
if (entry.isDirectory()) {
|
|
29
|
+
this.execute({sourcePath: sourceEntry, targetPath: targetEntry});
|
|
30
|
+
} else {
|
|
31
|
+
fs.copyFileSync(sourceEntry, targetEntry);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Copies only missing directories and files from source to target.
|
|
38
|
+
*
|
|
39
|
+
* @param {object} params
|
|
40
|
+
* @param {string[]} params.created
|
|
41
|
+
* @param {string} params.pathPrefix
|
|
42
|
+
* @param {string[]} params.skipped
|
|
43
|
+
* @param {string} params.sourcePath
|
|
44
|
+
* @param {string} params.targetPath
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
47
|
+
this.copyMissing = function ({created, pathPrefix, skipped, sourcePath, targetPath}) {
|
|
48
|
+
if (!fs.existsSync(targetPath)) {
|
|
49
|
+
fs.mkdirSync(targetPath, {recursive: true});
|
|
50
|
+
if (pathPrefix) created.push(pathPrefix);
|
|
51
|
+
}
|
|
52
|
+
for (const entry of fs.readdirSync(sourcePath, {withFileTypes: true})) {
|
|
53
|
+
const sourceEntry = pathService.join(sourcePath, entry.name);
|
|
54
|
+
const targetEntry = pathService.join(targetPath, entry.name);
|
|
55
|
+
const relativePath = pathPrefix ? pathService.join(pathPrefix, entry.name) : entry.name;
|
|
56
|
+
if (entry.isDirectory()) {
|
|
57
|
+
this.copyMissing({
|
|
58
|
+
created,
|
|
59
|
+
pathPrefix: relativePath,
|
|
60
|
+
skipped,
|
|
61
|
+
sourcePath: sourceEntry,
|
|
62
|
+
targetPath: targetEntry,
|
|
63
|
+
});
|
|
64
|
+
} else if (!fs.existsSync(targetEntry)) {
|
|
65
|
+
fs.copyFileSync(sourceEntry, targetEntry);
|
|
66
|
+
created.push(relativePath);
|
|
67
|
+
} else {
|
|
68
|
+
skipped.push(relativePath);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const __deps__ = Object.freeze({
|
|
76
|
+
fs: "node:fs",
|
|
77
|
+
pathService: "Fl32_Skill_Adsm_Ctx_Shared_Path$",
|
|
78
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @namespace Fl32_Skill_Adsm_Ctx_Shared_Metadata
|
|
5
|
+
* @description Creates baseline ADSM context metadata payloads.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export default class Metadata {
|
|
9
|
+
/**
|
|
10
|
+
* @param {object} deps
|
|
11
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Constants} deps.constants
|
|
12
|
+
*/
|
|
13
|
+
constructor({constants}) {
|
|
14
|
+
/**
|
|
15
|
+
* Creates the baseline metadata object.
|
|
16
|
+
*
|
|
17
|
+
* @returns {{schema: string, version: string}}
|
|
18
|
+
*/
|
|
19
|
+
this.create = function () {
|
|
20
|
+
return {
|
|
21
|
+
schema: constants.CONTEXT_SCHEMA,
|
|
22
|
+
version: constants.CONTEXT_VERSION,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const __deps__ = Object.freeze({
|
|
29
|
+
constants: "Fl32_Skill_Adsm_Ctx_Shared_Constants$",
|
|
30
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @namespace Fl32_Skill_Adsm_Ctx_Shared_Path
|
|
5
|
+
* @description Resolves filesystem paths using the Node.js path module.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export default class Path {
|
|
9
|
+
/**
|
|
10
|
+
* @param {object} deps
|
|
11
|
+
* @param {typeof import("node:path")} deps.path
|
|
12
|
+
*/
|
|
13
|
+
constructor({path}) {
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a path to an absolute path.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} targetPath
|
|
18
|
+
* @returns {string}
|
|
19
|
+
*/
|
|
20
|
+
this.resolve = function (targetPath) {
|
|
21
|
+
return path.resolve(targetPath);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Joins path segments.
|
|
26
|
+
*
|
|
27
|
+
* @param {...string} parts
|
|
28
|
+
* @returns {string}
|
|
29
|
+
*/
|
|
30
|
+
this.join = function (...parts) {
|
|
31
|
+
return path.join(...parts);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const __deps__ = Object.freeze({
|
|
37
|
+
path: "node:path",
|
|
38
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @namespace Fl32_Skill_Adsm_Ctx_Skill_Installer
|
|
5
|
+
* @description Installs the bundled skill payload into a target skills directory.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const sourceRoot = new URL("../../skill/", import.meta.url);
|
|
9
|
+
|
|
10
|
+
export default class Installer {
|
|
11
|
+
/**
|
|
12
|
+
* @param {object} deps
|
|
13
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_CopyDirectory} deps.copyDirectory
|
|
14
|
+
* @param {typeof import("node:fs")} deps.fs
|
|
15
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Path} deps.pathService
|
|
16
|
+
* @param {typeof import("node:url")} deps.url
|
|
17
|
+
*/
|
|
18
|
+
constructor({copyDirectory, fs, pathService, url}) {
|
|
19
|
+
/**
|
|
20
|
+
* Installs the skill payload.
|
|
21
|
+
*
|
|
22
|
+
* @param {object} params
|
|
23
|
+
* @param {string} params.targetRoot
|
|
24
|
+
* @returns {Promise<string>}
|
|
25
|
+
*/
|
|
26
|
+
this.execute = async function ({targetRoot}) {
|
|
27
|
+
if (!targetRoot) {
|
|
28
|
+
throw new Error("Target skills directory is required.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const targetDir = pathService.join(pathService.resolve(targetRoot), "adsm-ctx");
|
|
32
|
+
fs.rmSync(targetDir, {recursive: true, force: true});
|
|
33
|
+
copyDirectory.execute({
|
|
34
|
+
sourcePath: url.fileURLToPath(sourceRoot),
|
|
35
|
+
targetPath: targetDir,
|
|
36
|
+
});
|
|
37
|
+
return targetDir;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const __deps__ = Object.freeze({
|
|
43
|
+
copyDirectory: "Fl32_Skill_Adsm_Ctx_Shared_CopyDirectory$",
|
|
44
|
+
fs: "node:fs",
|
|
45
|
+
pathService: "Fl32_Skill_Adsm_Ctx_Shared_Path$",
|
|
46
|
+
url: "node:url",
|
|
47
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @namespace Fl32_Skill_Adsm_Ctx_Upgrade_Service
|
|
5
|
+
* @description Provides the baseline non-destructive upgrade entry point for ADSM context lifecycle.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export default class Service {
|
|
9
|
+
/**
|
|
10
|
+
* @param {object} deps
|
|
11
|
+
* @param {typeof import("node:fs")} deps.fs
|
|
12
|
+
* @param {Fl32_Skill_Adsm_Ctx_Shared_Path} deps.pathService
|
|
13
|
+
*/
|
|
14
|
+
constructor({fs, pathService}) {
|
|
15
|
+
/**
|
|
16
|
+
* Runs the upgrade entry point.
|
|
17
|
+
*
|
|
18
|
+
* @param {object} params
|
|
19
|
+
* @param {string} params.targetPath
|
|
20
|
+
* @returns {Promise<{message: string, ok: boolean}>}
|
|
21
|
+
*/
|
|
22
|
+
this.execute = async function ({targetPath}) {
|
|
23
|
+
const projectRoot = pathService.resolve(targetPath);
|
|
24
|
+
const metadataPath = pathService.join(projectRoot, "ctx", "adsm.json");
|
|
25
|
+
|
|
26
|
+
if (!fs.existsSync(metadataPath)) {
|
|
27
|
+
return {
|
|
28
|
+
message: "No ADSM context metadata found. Run `adsm-ctx init` before upgrade.",
|
|
29
|
+
ok: false,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
message: "No migrations are currently available for this context.",
|
|
35
|
+
ok: true,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const __deps__ = Object.freeze({
|
|
42
|
+
fs: "node:fs",
|
|
43
|
+
pathService: "Fl32_Skill_Adsm_Ctx_Shared_Path$",
|
|
44
|
+
});
|