sdtk-spec-kit 0.3.15 → 0.3.17
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.md +131 -2
- package/assets/atlas/build_atlas.py +865 -0
- package/assets/atlas/doc_atlas_viewer_template.html +3706 -0
- package/assets/atlas/vendor/mermaid.min.js +2029 -0
- package/assets/manifest/toolkit-bundle.manifest.json +16 -16
- package/assets/manifest/toolkit-bundle.sha256.txt +7 -7
- package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +14 -0
- package/assets/toolkit/toolkit/scripts/agents/run-claude-task.ps1 +332 -111
- package/assets/toolkit/toolkit/scripts/agents/run-codex-task.ps1 +517 -16
- package/assets/toolkit/toolkit/skills/sdtk-mailbox-dispatch/SKILL.md +73 -71
- package/assets/toolkit/toolkit/skills-claude/mailbox-dispatch/SKILL.md +73 -71
- package/assets/toolkit/toolkit/templates/mailbox/AGENT_REPORT_TEMPLATE.md +62 -49
- package/assets/toolkit/toolkit/templates/mailbox/AGENT_TASK_TEMPLATE.md +21 -10
- package/package.json +48 -48
- package/src/commands/atlas.js +379 -0
- package/src/commands/entitlement.js +163 -0
- package/src/commands/help.js +140 -6
- package/src/commands/project.js +51 -0
- package/src/index.js +10 -1
- package/src/lib/atlas-ask.js +170 -0
- package/src/lib/atlas-config.js +200 -0
- package/src/lib/atlas-runner.js +355 -0
- package/src/lib/browser-open.js +39 -0
- package/src/lib/capabilities.js +98 -0
- package/src/lib/entitlements.js +203 -0
- package/src/lib/github-access.js +75 -0
- package/src/lib/legacy-auth-migration.js +56 -0
- package/src/lib/premium-loader.js +126 -0
- package/src/lib/premium-packs.js +333 -0
- package/src/lib/premium-sync.js +235 -0
- package/src/lib/project-audit.js +332 -0
- package/src/lib/project-config.js +108 -0
- package/src/lib/project-ingest.js +450 -0
- package/src/lib/project-refresh.js +666 -0
- package/src/lib/project-target-guard.js +28 -2
- package/src/lib/state.js +37 -46
- package/src/lib/suite-state.js +65 -0
package/src/lib/state.js
CHANGED
|
@@ -1,55 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const fs = require("fs");
|
|
4
|
-
const os = require("os");
|
|
5
4
|
const path = require("path");
|
|
6
|
-
const {
|
|
5
|
+
const { ensureDir, getAuthFile, hardenFilePermissions } = require("./suite-state");
|
|
6
|
+
const { migrateLegacyAuthStateIfNeeded } = require("./legacy-auth-migration");
|
|
7
7
|
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function readAuthPayload(authFile) {
|
|
9
|
+
try {
|
|
10
|
+
const payload = JSON.parse(fs.readFileSync(authFile, "utf8"));
|
|
11
|
+
if (!payload || typeof payload !== "object") {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return payload;
|
|
15
|
+
} catch (_error) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
10
18
|
}
|
|
11
19
|
|
|
12
|
-
function
|
|
13
|
-
|
|
20
|
+
function normalizeAuthState(payload) {
|
|
21
|
+
const token = typeof payload.github_token === "string" ? payload.github_token : "";
|
|
22
|
+
return { authenticated: token.length > 0, token };
|
|
14
23
|
}
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function hardenFilePermissions(filePath) {
|
|
23
|
-
try {
|
|
24
|
-
if (process.platform === "win32") {
|
|
25
|
-
const username = os.userInfo().username;
|
|
26
|
-
execFileSync("icacls", [
|
|
27
|
-
filePath,
|
|
28
|
-
"/inheritance:r",
|
|
29
|
-
"/grant:r",
|
|
30
|
-
`${username}:(F)`,
|
|
31
|
-
], { stdio: "ignore" });
|
|
32
|
-
} else {
|
|
33
|
-
fs.chmodSync(filePath, 0o600);
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
} catch (_err) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
25
|
+
function writeAuthPayload(payload) {
|
|
26
|
+
const authFile = getAuthFile();
|
|
27
|
+
ensureDir(path.dirname(authFile));
|
|
28
|
+
fs.writeFileSync(authFile, JSON.stringify(payload, null, 2), "utf8");
|
|
29
|
+
const hardened = hardenFilePermissions(authFile);
|
|
30
|
+
return { path: authFile, hardened };
|
|
39
31
|
}
|
|
40
32
|
|
|
41
33
|
function readAuthState() {
|
|
42
34
|
const authFile = getAuthFile();
|
|
43
35
|
if (!fs.existsSync(authFile)) {
|
|
44
|
-
|
|
36
|
+
const migration = migrateLegacyAuthStateIfNeeded();
|
|
37
|
+
if (migration.malformedLegacy || !fs.existsSync(authFile)) {
|
|
38
|
+
return { authenticated: false, token: "" };
|
|
39
|
+
}
|
|
45
40
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return { authenticated: token.length > 0, token };
|
|
50
|
-
} catch (_error) {
|
|
41
|
+
|
|
42
|
+
const payload = readAuthPayload(authFile);
|
|
43
|
+
if (!payload) {
|
|
51
44
|
return { authenticated: false, token: "" };
|
|
52
45
|
}
|
|
46
|
+
|
|
47
|
+
return normalizeAuthState(payload);
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
/**
|
|
@@ -57,21 +52,17 @@ function readAuthState() {
|
|
|
57
52
|
* @returns {{ path: string, hardened: boolean }}
|
|
58
53
|
*/
|
|
59
54
|
function writeAuthState(token) {
|
|
60
|
-
|
|
61
|
-
const payload = {
|
|
55
|
+
return writeAuthPayload({
|
|
62
56
|
github_token: token,
|
|
63
57
|
updated_at: new Date().toISOString(),
|
|
64
|
-
};
|
|
65
|
-
fs.writeFileSync(authFile, JSON.stringify(payload, null, 2), "utf8");
|
|
66
|
-
const hardened = hardenFilePermissions(authFile);
|
|
67
|
-
return { path: authFile, hardened };
|
|
58
|
+
});
|
|
68
59
|
}
|
|
69
60
|
|
|
70
61
|
function clearAuthState() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
62
|
+
return writeAuthPayload({
|
|
63
|
+
github_token: "",
|
|
64
|
+
updated_at: new Date().toISOString(),
|
|
65
|
+
});
|
|
75
66
|
}
|
|
76
67
|
|
|
77
68
|
module.exports = {
|
|
@@ -80,4 +71,4 @@ module.exports = {
|
|
|
80
71
|
readAuthState,
|
|
81
72
|
writeAuthState,
|
|
82
73
|
clearAuthState,
|
|
83
|
-
};
|
|
74
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const { execFileSync } = require("child_process");
|
|
7
|
+
|
|
8
|
+
function ensureDir(dirPath) {
|
|
9
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getSuiteRoot() {
|
|
13
|
+
return path.join(os.homedir(), ".sdtk");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getAuthFile() {
|
|
17
|
+
return path.join(getSuiteRoot(), "auth.json");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getEntitlementsFile() {
|
|
21
|
+
return path.join(getSuiteRoot(), "entitlements.json");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getPacksRoot() {
|
|
25
|
+
return path.join(getSuiteRoot(), "packs");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getLogsRoot() {
|
|
29
|
+
return path.join(getSuiteRoot(), "logs");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Harden file permissions so only the current user can read/write.
|
|
34
|
+
* - POSIX: chmod 600
|
|
35
|
+
* - Windows: icacls to grant only current user Full Control
|
|
36
|
+
* @returns {boolean} true if hardening succeeded, false otherwise.
|
|
37
|
+
*/
|
|
38
|
+
function hardenFilePermissions(filePath) {
|
|
39
|
+
try {
|
|
40
|
+
if (process.platform === "win32") {
|
|
41
|
+
const username = os.userInfo().username;
|
|
42
|
+
execFileSync("icacls", [
|
|
43
|
+
filePath,
|
|
44
|
+
"/inheritance:r",
|
|
45
|
+
"/grant:r",
|
|
46
|
+
`${username}:(F)`,
|
|
47
|
+
], { stdio: "ignore" });
|
|
48
|
+
} else {
|
|
49
|
+
fs.chmodSync(filePath, 0o600);
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
} catch (_err) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
ensureDir,
|
|
59
|
+
getSuiteRoot,
|
|
60
|
+
getAuthFile,
|
|
61
|
+
getEntitlementsFile,
|
|
62
|
+
getPacksRoot,
|
|
63
|
+
getLogsRoot,
|
|
64
|
+
hardenFilePermissions,
|
|
65
|
+
};
|