sdtk-kit 0.3.8 → 1.0.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.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +123 -177
  3. package/package.json +52 -46
  4. package/scripts/postinstall.js +40 -0
  5. package/assets/manifest/toolkit-bundle.manifest.json +0 -473
  6. package/assets/manifest/toolkit-bundle.sha256.txt +0 -93
  7. package/assets/toolkit/toolkit/AGENTS.md +0 -131
  8. package/assets/toolkit/toolkit/install.ps1 +0 -270
  9. package/assets/toolkit/toolkit/runtimes/claude/CLAUDE_TEMPLATE.md +0 -54
  10. package/assets/toolkit/toolkit/runtimes/codex/CODEX_TEMPLATE.md +0 -32
  11. package/assets/toolkit/toolkit/scripts/init-feature.ps1 +0 -261
  12. package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +0 -129
  13. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +0 -189
  14. package/assets/toolkit/toolkit/scripts/uninstall-claude-skills.ps1 +0 -139
  15. package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +0 -116
  16. package/assets/toolkit/toolkit/sdtk.config.json +0 -28
  17. package/assets/toolkit/toolkit/sdtk.config.profiles.example.json +0 -50
  18. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +0 -84
  19. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_CREATION_RULES.md +0 -22
  20. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
  21. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/FLOWCHART_CREATION_RULES.md +0 -20
  22. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py +0 -656
  23. package/assets/toolkit/toolkit/skills/sdtk-api-doc/SKILL.md +0 -43
  24. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
  25. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/FLOWCHART_CREATION_RULES.md +0 -20
  26. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/YAML_CREATION_RULES.md +0 -128
  27. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +0 -83
  28. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_CREATION_RULES.md +0 -22
  29. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
  30. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOWCHART_CREATION_RULES.md +0 -20
  31. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +0 -200
  32. package/assets/toolkit/toolkit/skills/sdtk-arch/references/YAML_CREATION_RULES.md +0 -128
  33. package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +0 -29
  34. package/assets/toolkit/toolkit/skills/sdtk-design-layout/SKILL.md +0 -41
  35. package/assets/toolkit/toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py +0 -213
  36. package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +0 -90
  37. package/assets/toolkit/toolkit/skills/sdtk-dev/prompts/code-quality-reviewer.md +0 -35
  38. package/assets/toolkit/toolkit/skills/sdtk-dev/prompts/implementer.md +0 -61
  39. package/assets/toolkit/toolkit/skills/sdtk-dev/prompts/spec-reviewer.md +0 -42
  40. package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +0 -21
  41. package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +0 -19
  42. package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +0 -80
  43. package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +0 -30
  44. package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +0 -53
  45. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/SKILL.md +0 -73
  46. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +0 -200
  47. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/excel-image-export.md +0 -51
  48. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/figma-mcp.md +0 -54
  49. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/numbering-rules.md +0 -76
  50. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/scripts/renumber_flow_action_spec_global.py +0 -136
  51. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/scripts/validate_flow_action_spec_numbering.py +0 -249
  52. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/SKILL.md +0 -74
  53. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/references/TEST_CASE_CREATION_RULES.md +0 -129
  54. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/scripts/validate_test_case_spec.py +0 -97
  55. package/assets/toolkit/toolkit/skills/skills.catalog.yaml +0 -302
  56. package/assets/toolkit/toolkit/skills-claude/api-design-spec/SKILL.md +0 -76
  57. package/assets/toolkit/toolkit/skills-claude/api-doc/SKILL.md +0 -47
  58. package/assets/toolkit/toolkit/skills-claude/arch/SKILL.md +0 -72
  59. package/assets/toolkit/toolkit/skills-claude/ba/SKILL.md +0 -50
  60. package/assets/toolkit/toolkit/skills-claude/design-layout/SKILL.md +0 -25
  61. package/assets/toolkit/toolkit/skills-claude/dev/SKILL.md +0 -45
  62. package/assets/toolkit/toolkit/skills-claude/dev-backend/SKILL.md +0 -20
  63. package/assets/toolkit/toolkit/skills-claude/dev-frontend/SKILL.md +0 -18
  64. package/assets/toolkit/toolkit/skills-claude/orchestrator/SKILL.md +0 -63
  65. package/assets/toolkit/toolkit/skills-claude/pm/SKILL.md +0 -52
  66. package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +0 -48
  67. package/assets/toolkit/toolkit/skills-claude/screen-design-spec/SKILL.md +0 -68
  68. package/assets/toolkit/toolkit/skills-claude/test-case-spec/SKILL.md +0 -61
  69. package/assets/toolkit/toolkit/templates/QUALITY_CHECKLIST.md +0 -124
  70. package/assets/toolkit/toolkit/templates/README.md +0 -63
  71. package/assets/toolkit/toolkit/templates/SHARED_PLANNING.md +0 -80
  72. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_CREATION_RULES.md +0 -22
  73. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_DETAIL_TEMPLATE.md +0 -67
  74. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
  75. package/assets/toolkit/toolkit/templates/docs/api/API_ENDPOINTS_TEMPLATE.md +0 -229
  76. package/assets/toolkit/toolkit/templates/docs/api/FEATURE_API_TEMPLATE.yaml +0 -20
  77. package/assets/toolkit/toolkit/templates/docs/api/FLOWCHART_CREATION_RULES.md +0 -20
  78. package/assets/toolkit/toolkit/templates/docs/api/YAML_CREATION_RULES.md +0 -128
  79. package/assets/toolkit/toolkit/templates/docs/api/feature_api_flow_list_TEMPLATE.txt +0 -12
  80. package/assets/toolkit/toolkit/templates/docs/architecture/ARCH_DESIGN_TEMPLATE.md +0 -109
  81. package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +0 -175
  82. package/assets/toolkit/toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md +0 -49
  83. package/assets/toolkit/toolkit/templates/docs/dev/FEATURE_IMPL_PLAN_TEMPLATE.md +0 -73
  84. package/assets/toolkit/toolkit/templates/docs/product/BACKLOG_TEMPLATE.md +0 -50
  85. package/assets/toolkit/toolkit/templates/docs/product/PRD_TEMPLATE.md +0 -66
  86. package/assets/toolkit/toolkit/templates/docs/product/PROJECT_INITIATION_TEMPLATE.md +0 -98
  87. package/assets/toolkit/toolkit/templates/docs/qa/QA_RELEASE_REPORT_TEMPLATE.md +0 -61
  88. package/assets/toolkit/toolkit/templates/docs/qa/TEST_CASE_CREATION_RULES.md +0 -129
  89. package/assets/toolkit/toolkit/templates/docs/qa/TEST_CASE_TEMPLATE.md +0 -104
  90. package/assets/toolkit/toolkit/templates/docs/specs/BA_SPEC_TEMPLATE.md +0 -139
  91. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +0 -200
  92. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_TEMPLATE.md +0 -172
  93. package/assets/toolkit/toolkit/templates/handoffs/ARCH_TO_DEV.md +0 -31
  94. package/assets/toolkit/toolkit/templates/handoffs/BA_TO_ARCH.md +0 -28
  95. package/assets/toolkit/toolkit/templates/handoffs/DEV_STAGE1_SPEC_REVIEW.md +0 -26
  96. package/assets/toolkit/toolkit/templates/handoffs/DEV_STAGE2_CODE_QUALITY_REVIEW.md +0 -20
  97. package/assets/toolkit/toolkit/templates/handoffs/DEV_TO_QA.md +0 -23
  98. package/assets/toolkit/toolkit/templates/handoffs/PM_TO_BA.md +0 -26
  99. package/assets/toolkit/toolkit/templates/handoffs/QA_RELEASE_DECISION.md +0 -21
  100. package/bin/sdtk.js +0 -15
  101. package/src/commands/auth.js +0 -85
  102. package/src/commands/generate.js +0 -177
  103. package/src/commands/help.js +0 -101
  104. package/src/commands/init.js +0 -97
  105. package/src/commands/runtime.js +0 -217
  106. package/src/index.js +0 -59
  107. package/src/lib/args.js +0 -116
  108. package/src/lib/errors.js +0 -41
  109. package/src/lib/github-access.js +0 -68
  110. package/src/lib/powershell.js +0 -85
  111. package/src/lib/scope.js +0 -68
  112. package/src/lib/state.js +0 -83
  113. package/src/lib/toolkit-payload.js +0 -99
@@ -1,177 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const { parseFlags, requireFlag, validatePattern } = require("../lib/args");
6
- const { verify, resolvePayloadFile } = require("../lib/toolkit-payload");
7
- const { runScript } = require("../lib/powershell");
8
- const { ValidationError } = require("../lib/errors");
9
-
10
- /**
11
- * Expected 17 output files from generate.
12
- * Placeholders: {KEY} = UPPER_SNAKE_CASE, {PASCAL} = PascalCase, {SNAKE} = lower_snake_case
13
- */
14
- const EXPECTED_OUTPUT_FILES = [
15
- "SHARED_PLANNING.md",
16
- "QUALITY_CHECKLIST.md",
17
- "docs/product/PROJECT_INITIATION_{KEY}.md",
18
- "docs/specs/BA_SPEC_{KEY}.md",
19
- "docs/specs/{KEY}_FLOW_ACTION_SPEC.md",
20
- "docs/product/PRD_{KEY}.md",
21
- "docs/product/BACKLOG_{KEY}.md",
22
- "docs/architecture/ARCH_DESIGN_{KEY}.md",
23
- "docs/database/DATABASE_SPEC_{KEY}.md",
24
- "docs/api/{PASCAL}_API.yaml",
25
- "docs/api/{KEY}_ENDPOINTS.md",
26
- "docs/api/{KEY}_API_DESIGN_DETAIL.md",
27
- "docs/api/{SNAKE}_api_flow_list.txt",
28
- "docs/design/DESIGN_LAYOUT_{KEY}.md",
29
- "docs/dev/FEATURE_IMPL_PLAN_{KEY}.md",
30
- "docs/qa/{KEY}_TEST_CASE.md",
31
- "docs/qa/QA_RELEASE_REPORT_{KEY}.md",
32
- ];
33
-
34
- /**
35
- * Convert text to PascalCase.
36
- * Mirrors init-feature.ps1 ConvertTo-PascalCase: split on non-alphanumeric,
37
- * capitalize first letter of each part, preserve rest of casing per part.
38
- * e.g. "Order Management" -> "OrderManagement", "USER_PROFILE" -> "UserProfile"
39
- */
40
- function toPascalCase(text) {
41
- const parts = text.split(/[^A-Za-z0-9]+/).filter((p) => p.length > 0);
42
- return parts
43
- .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
44
- .join("");
45
- }
46
-
47
- /**
48
- * Derive PascalCase matching init-feature.ps1 logic:
49
- * prefer featureName, fallback to featureKey.
50
- */
51
- function derivePascalCase(featureName, featureKey) {
52
- const fromName = toPascalCase(featureName);
53
- return fromName || toPascalCase(featureKey);
54
- }
55
-
56
- /**
57
- * Convert UPPER_SNAKE_CASE to lower_snake_case.
58
- */
59
- function toSnakeCase(upperSnake) {
60
- return upperSnake.toLowerCase();
61
- }
62
-
63
- /**
64
- * Expand placeholders and return list of expected file paths relative to project root.
65
- */
66
- function expandExpectedFiles(featureKey, featureName) {
67
- const pascal = derivePascalCase(featureName, featureKey);
68
- const snake = toSnakeCase(featureKey);
69
- return EXPECTED_OUTPUT_FILES.map((tmpl) =>
70
- tmpl.replace(/\{KEY\}/g, featureKey).replace(/\{PASCAL\}/g, pascal).replace(/\{SNAKE\}/g, snake)
71
- );
72
- }
73
-
74
- /**
75
- * Verify all 17 expected output files exist under projectPath.
76
- * Returns list of missing files (empty if all present).
77
- */
78
- function verifyOutputContract(projectPath, featureKey, featureName) {
79
- const expected = expandExpectedFiles(featureKey, featureName);
80
- const missing = [];
81
- for (const rel of expected) {
82
- const full = path.join(projectPath, rel);
83
- if (!fs.existsSync(full)) {
84
- missing.push(rel);
85
- }
86
- }
87
- return missing;
88
- }
89
-
90
- const FLAG_DEFS = {
91
- "feature-key": { type: "string" },
92
- "feature-name": { type: "string" },
93
- "project-path": { type: "string" },
94
- force: { type: "boolean" },
95
- "validate-only": { type: "boolean" },
96
- verbose: { type: "boolean" },
97
- };
98
-
99
- const FEATURE_KEY_REGEX = /^[A-Z][A-Z0-9_]*$/;
100
-
101
- async function cmdGenerate(args) {
102
- const { flags } = parseFlags(args, FLAG_DEFS);
103
-
104
- // Validate required flags
105
- const featureKey = requireFlag(flags, "feature-key", "feature-key");
106
- const featureName = requireFlag(flags, "feature-name", "feature-name");
107
-
108
- // Validate feature key format
109
- validatePattern(
110
- featureKey,
111
- FEATURE_KEY_REGEX,
112
- "feature-key",
113
- "Must be UPPER_SNAKE_CASE (e.g., USER_PROFILE, ORDER_MANAGEMENT)."
114
- );
115
-
116
- // Resolve project path
117
- const projectPath = flags["project-path"]
118
- ? path.resolve(flags["project-path"])
119
- : process.cwd();
120
-
121
- // Verify payload integrity before proceeding
122
- verify();
123
-
124
- // Resolve bundled init-feature.ps1
125
- const generateScript = resolvePayloadFile(
126
- "toolkit/scripts/init-feature.ps1"
127
- );
128
-
129
- // Build PowerShell parameters
130
- const params = {
131
- FeatureKey: featureKey,
132
- FeatureName: featureName,
133
- ProjectPath: projectPath,
134
- };
135
- if (flags.force) params.Force = true;
136
- if (flags["validate-only"]) params.ValidateOnly = true;
137
-
138
- console.log(`Generating documentation for feature: ${featureKey}`);
139
- console.log(` Feature name: ${featureName}`);
140
- console.log(` Project path: ${projectPath}`);
141
- if (flags["validate-only"]) {
142
- console.log(" Mode: validate-only (no files will be written)");
143
- }
144
- console.log("");
145
-
146
- const result = await runScript(generateScript, params, { silent: !flags.verbose });
147
-
148
- if (result.exitCode !== 0) {
149
- if (result.stderr) {
150
- console.error(result.stderr);
151
- }
152
- throw new ValidationError(
153
- `Generation failed (exit code ${result.exitCode}).`
154
- );
155
- }
156
-
157
- // Enforce 17-file output contract (skip for validate-only mode)
158
- if (!flags["validate-only"]) {
159
- const missing = verifyOutputContract(projectPath, featureKey, featureName);
160
- if (missing.length > 0) {
161
- console.error("\nOutput contract violation -- missing files:");
162
- for (const f of missing) {
163
- console.error(` - ${f}`);
164
- }
165
- throw new ValidationError(
166
- `Expected 17 output files but ${missing.length} missing. See list above.`
167
- );
168
- }
169
- console.log("\nAll 17 expected output files verified.");
170
- }
171
-
172
- return 0;
173
- }
174
-
175
- module.exports = {
176
- cmdGenerate,
177
- };
@@ -1,101 +0,0 @@
1
- "use strict";
2
-
3
- function cmdHelp() {
4
- const text = [
5
- "SDTK CLI -- deterministic documentation toolkit",
6
- "",
7
- "Usage:",
8
- " sdtk <command> [options]",
9
- "",
10
- "Commands:",
11
- " init Initialize SDTK workspace (runtime adapter + config)",
12
- " runtime Manage runtime asset installation (install, uninstall, status)",
13
- " auth Manage GitHub authentication and entitlement",
14
- " generate Scaffold feature documentation from templates (17 files)",
15
- "",
16
- "Init options:",
17
- " --runtime <codex|claude> Runtime adapter (default: codex)",
18
- " --runtime-scope <project|user> Install scope (default: project for claude, user for codex)",
19
- " --project-path <path> Target project directory (default: cwd)",
20
- " --force Overwrite existing files",
21
- " --skip-runtime-assets Skip runtime asset installation",
22
- " --skip-skills (deprecated, use --skip-runtime-assets)",
23
- " --verbose Show detailed PowerShell script output",
24
- "",
25
- "Runtime subcommands:",
26
- " sdtk runtime install --runtime <codex|claude> [--scope <project|user>]",
27
- " sdtk runtime uninstall --runtime <codex|claude> [--scope <project|user>] [--all]",
28
- " sdtk runtime status --runtime <codex|claude>",
29
- "",
30
- "Runtime options:",
31
- " --runtime <codex|claude> Target runtime (required)",
32
- " --scope <project|user> Install scope (default: project for claude, user for codex)",
33
- " --project-path <path> Target project directory (default: cwd)",
34
- " --force Overwrite existing skills",
35
- " --all Uninstall all managed skills",
36
- " --verbose Show detailed script output",
37
- "",
38
- "Scope behavior:",
39
- " project Skills are installed inside the repo (Claude only: .claude/skills/)",
40
- " user Skills are installed in the runtime home (~/.claude/skills/ or ~/.codex/skills/)",
41
- " Note: Codex supports user scope only. Project scope is not available for Codex.",
42
- "",
43
- "Auth options:",
44
- " --token <value> Store GitHub PAT",
45
- " --verify Check private repo access",
46
- " --status Show authentication status",
47
- " --logout Clear stored credentials",
48
- "",
49
- "Generate options:",
50
- " --feature-key <KEY> Feature identifier (UPPER_SNAKE_CASE, required)",
51
- " --feature-name \"<text>\" Human-readable feature name (required)",
52
- " --project-path <path> Target project directory (default: cwd)",
53
- " --force Overwrite existing files",
54
- " --validate-only Validate templates without writing files",
55
- " --verbose Show detailed PowerShell script output",
56
- "",
57
- "Generate behavior:",
58
- " The generate command creates 17 scaffold files with TBD placeholders.",
59
- " Scaffolds define document structure for each SDLC phase.",
60
- " Content is filled in by agents or manually (PM -> BA -> ARCH -> DEV -> QA).",
61
- " Output is written to docs/ subdirectories under the project path.",
62
- "",
63
- "Global options:",
64
- " -h, --help Show this help",
65
- " -v, --version Show version",
66
- "",
67
- "Exit codes:",
68
- " 0 Success",
69
- " 1 Validation or user error",
70
- " 2 Dependency error (e.g., PowerShell not found)",
71
- " 3 Integrity error (payload hash mismatch)",
72
- " 4 Unexpected internal error",
73
- "",
74
- "Environment variables:",
75
- " SDTK_ENTITLEMENT_REPO Override default entitlement repo (owner/repo format)",
76
- "",
77
- "Examples:",
78
- " sdtk init --runtime codex",
79
- " sdtk init --runtime claude --project-path ./my-project",
80
- " sdtk auth --token ghp_xxxxxxxxxxxx",
81
- " sdtk auth --verify",
82
- ' sdtk generate --feature-key USER_PROFILE --feature-name "User Profile"',
83
- " sdtk generate --feature-key ORDER_MGMT --feature-name \"Order Management\" --validate-only",
84
- " sdtk init --runtime claude --runtime-scope user",
85
- " sdtk runtime install --runtime claude --scope project",
86
- " sdtk runtime install --runtime codex --scope user",
87
- " sdtk runtime status --runtime claude",
88
- " sdtk runtime uninstall --runtime claude --scope project --all",
89
- "",
90
- " # Override entitlement repo (bash/zsh):",
91
- " export SDTK_ENTITLEMENT_REPO=owner/repo",
92
- " # Override entitlement repo (PowerShell):",
93
- ' $env:SDTK_ENTITLEMENT_REPO="owner/repo"',
94
- ];
95
- console.log(text.join("\n"));
96
- return 0;
97
- }
98
-
99
- module.exports = {
100
- cmdHelp,
101
- };
@@ -1,97 +0,0 @@
1
- "use strict";
2
-
3
- const path = require("path");
4
- const { parseFlags, validateChoice } = require("../lib/args");
5
- const { verify, resolvePayloadFile } = require("../lib/toolkit-payload");
6
- const { runScript } = require("../lib/powershell");
7
- const { ValidationError } = require("../lib/errors");
8
- const { VALID_SCOPES, defaultScope, isProjectScopeSupported } = require("../lib/scope");
9
-
10
- const FLAG_DEFS = {
11
- runtime: { type: "string" },
12
- "project-path": { type: "string" },
13
- "runtime-scope": { type: "string" },
14
- force: { type: "boolean" },
15
- "skip-skills": { type: "boolean" },
16
- "skip-runtime-assets": { type: "boolean" },
17
- verbose: { type: "boolean" },
18
- };
19
-
20
- const VALID_RUNTIMES = ["codex", "claude"];
21
-
22
- async function cmdInit(args) {
23
- const { flags } = parseFlags(args, FLAG_DEFS);
24
-
25
- // Validate runtime
26
- const runtime = flags.runtime || "codex";
27
- validateChoice(runtime, VALID_RUNTIMES, "runtime");
28
-
29
- // Resolve scope
30
- const scope = flags["runtime-scope"] || defaultScope(runtime);
31
- validateChoice(scope, VALID_SCOPES, "runtime-scope");
32
-
33
- // Gate C0: Codex does not support project-local skills
34
- if (scope === "project" && !isProjectScopeSupported(runtime)) {
35
- throw new ValidationError(
36
- "Codex does not support project-local skills. Use --runtime-scope user instead."
37
- );
38
- }
39
-
40
- // Handle deprecated --skip-skills
41
- const skipAssets = flags["skip-runtime-assets"] || flags["skip-skills"];
42
- if (flags["skip-skills"] && !flags["skip-runtime-assets"]) {
43
- console.warn(
44
- "Warning: --skip-skills is deprecated. Use --skip-runtime-assets instead."
45
- );
46
- }
47
-
48
- // Resolve project path
49
- const projectPath = flags["project-path"]
50
- ? path.resolve(flags["project-path"])
51
- : process.cwd();
52
-
53
- // Verify payload integrity before proceeding
54
- verify();
55
-
56
- // Resolve bundled install.ps1
57
- const installScript = resolvePayloadFile("toolkit/install.ps1");
58
-
59
- // Build PowerShell parameters
60
- const params = {
61
- ProjectPath: projectPath,
62
- Runtime: runtime,
63
- Scope: scope,
64
- };
65
- if (flags.force) params.Force = true;
66
- if (skipAssets) params.SkipRuntimeAssets = true;
67
- if (!flags.verbose) params.Quiet = true;
68
-
69
- console.log(`Initializing SDTK workspace...`);
70
- console.log(` Runtime: ${runtime}`);
71
- console.log(` Scope: ${scope}`);
72
- console.log(` Project: ${projectPath}`);
73
- console.log("");
74
-
75
- const result = await runScript(installScript, params, { silent: !flags.verbose });
76
-
77
- if (result.exitCode !== 0) {
78
- if (result.stderr) {
79
- console.error(result.stderr);
80
- }
81
- throw new ValidationError(
82
- `Initialization failed (exit code ${result.exitCode}).`
83
- );
84
- }
85
-
86
- console.log("");
87
- console.log("SDTK workspace initialized successfully.");
88
- console.log("");
89
- console.log("Next steps:");
90
- console.log(" 1. Review and customize sdtk.config.json for your project stack.");
91
- console.log(' 2. Run "sdtk generate --feature-key <KEY> --feature-name <name>" to scaffold docs.');
92
- return 0;
93
- }
94
-
95
- module.exports = {
96
- cmdInit,
97
- };
@@ -1,217 +0,0 @@
1
- "use strict";
2
-
3
- const path = require("path");
4
- const fs = require("fs");
5
- const { parseFlags, requireFlag, validateChoice } = require("../lib/args");
6
- const { verify, resolvePayloadFile } = require("../lib/toolkit-payload");
7
- const { runScript } = require("../lib/powershell");
8
- const { ValidationError } = require("../lib/errors");
9
- const {
10
- VALID_SCOPES,
11
- defaultScope,
12
- isProjectScopeSupported,
13
- resolveSkillsDir,
14
- managedSkillNames,
15
- } = require("../lib/scope");
16
-
17
- const FLAG_DEFS = {
18
- runtime: { type: "string" },
19
- scope: { type: "string" },
20
- "project-path": { type: "string" },
21
- force: { type: "boolean" },
22
- all: { type: "boolean" },
23
- verbose: { type: "boolean" },
24
- };
25
-
26
- const VALID_RUNTIMES = ["codex", "claude"];
27
- const SUBCOMMANDS = ["install", "uninstall", "status"];
28
-
29
- function validateScopeForRuntime(runtime, scope) {
30
- if (scope === "project" && !isProjectScopeSupported(runtime)) {
31
- throw new ValidationError(
32
- `Codex does not support project-local skills. Use --scope user instead.`
33
- );
34
- }
35
- }
36
-
37
- async function cmdRuntimeInstall(flags) {
38
- const runtime = requireFlag(flags, "runtime", "runtime");
39
- validateChoice(runtime, VALID_RUNTIMES, "runtime");
40
-
41
- const scope = flags.scope || defaultScope(runtime);
42
- validateChoice(scope, VALID_SCOPES, "scope");
43
- validateScopeForRuntime(runtime, scope);
44
-
45
- const projectPath = flags["project-path"]
46
- ? path.resolve(flags["project-path"])
47
- : process.cwd();
48
-
49
- verify();
50
-
51
- const scriptName =
52
- runtime === "claude"
53
- ? "toolkit/scripts/install-claude-skills.ps1"
54
- : "toolkit/scripts/install-codex-skills.ps1";
55
- const script = resolvePayloadFile(scriptName);
56
-
57
- const params = { Scope: scope };
58
- if (runtime === "claude") {
59
- params.ProjectPath = projectPath;
60
- }
61
- if (flags.force) params.Force = true;
62
-
63
- console.log(`Installing ${runtime} runtime assets...`);
64
- console.log(` Runtime: ${runtime}`);
65
- console.log(` Scope: ${scope}`);
66
- if (scope === "project") {
67
- console.log(` Project: ${projectPath}`);
68
- }
69
- console.log("");
70
-
71
- const result = await runScript(script, params, {
72
- silent: !flags.verbose,
73
- });
74
-
75
- if (result.exitCode !== 0) {
76
- if (result.stderr) console.error(result.stderr);
77
- throw new ValidationError(
78
- `Runtime install failed (exit code ${result.exitCode}).`
79
- );
80
- }
81
-
82
- console.log("");
83
- console.log(`${runtime} runtime assets installed successfully.`);
84
- return 0;
85
- }
86
-
87
- async function cmdRuntimeUninstall(flags) {
88
- const runtime = requireFlag(flags, "runtime", "runtime");
89
- validateChoice(runtime, VALID_RUNTIMES, "runtime");
90
-
91
- const scope = flags.scope || defaultScope(runtime);
92
- validateChoice(scope, VALID_SCOPES, "scope");
93
- validateScopeForRuntime(runtime, scope);
94
-
95
- const projectPath = flags["project-path"]
96
- ? path.resolve(flags["project-path"])
97
- : process.cwd();
98
-
99
- verify();
100
-
101
- const scriptName =
102
- runtime === "claude"
103
- ? "toolkit/scripts/uninstall-claude-skills.ps1"
104
- : "toolkit/scripts/uninstall-codex-skills.ps1";
105
- const script = resolvePayloadFile(scriptName);
106
-
107
- const params = {};
108
- if (runtime === "claude") {
109
- params.Scope = scope;
110
- params.ProjectPath = projectPath;
111
- }
112
- if (flags.all) params.All = true;
113
-
114
- console.log(`Uninstalling ${runtime} runtime assets...`);
115
- console.log(` Runtime: ${runtime}`);
116
- console.log(` Scope: ${scope}`);
117
- console.log("");
118
-
119
- const result = await runScript(script, params, {
120
- silent: !flags.verbose,
121
- });
122
-
123
- if (result.exitCode !== 0) {
124
- if (result.stderr) console.error(result.stderr);
125
- throw new ValidationError(
126
- `Runtime uninstall failed (exit code ${result.exitCode}).`
127
- );
128
- }
129
-
130
- console.log("");
131
- console.log(`${runtime} runtime assets uninstalled successfully.`);
132
- return 0;
133
- }
134
-
135
- function cmdRuntimeStatus(flags) {
136
- const runtime = requireFlag(flags, "runtime", "runtime");
137
- validateChoice(runtime, VALID_RUNTIMES, "runtime");
138
-
139
- const projectPath = flags["project-path"]
140
- ? path.resolve(flags["project-path"])
141
- : process.cwd();
142
-
143
- console.log(`Runtime: ${runtime}`);
144
- console.log("");
145
-
146
- // Check both scopes
147
- const scopes = runtime === "claude" ? ["project", "user"] : ["user"];
148
-
149
- for (const scope of scopes) {
150
- const skillsDir = resolveSkillsDir(runtime, scope, projectPath);
151
- const exists = fs.existsSync(skillsDir);
152
- let skillCount = 0;
153
-
154
- const managed = managedSkillNames(runtime);
155
- let installedNames = [];
156
-
157
- if (exists) {
158
- try {
159
- const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
160
- installedNames = entries
161
- .filter((e) => e.isDirectory() && managed.includes(e.name))
162
- .map((e) => e.name);
163
- skillCount = installedNames.length;
164
- } catch {
165
- // Directory not readable
166
- }
167
- }
168
-
169
- const allInstalled = skillCount === managed.length;
170
-
171
- console.log(` Scope: ${scope}`);
172
- console.log(` Path: ${skillsDir}`);
173
- const statusLabel = !exists
174
- ? "not installed"
175
- : allInstalled
176
- ? `installed (${skillCount}/${managed.length} SDTK skills)`
177
- : `partial (${skillCount}/${managed.length} SDTK skills)`;
178
- console.log(` Status: ${statusLabel}`);
179
- if (exists && skillCount < managed.length) {
180
- const missing = managed.filter((n) => !installedNames.includes(n));
181
- console.log(` Missing: ${missing.join(", ")}`);
182
- }
183
- console.log("");
184
- }
185
-
186
- return 0;
187
- }
188
-
189
- async function cmdRuntime(args) {
190
- const { flags, positional } = parseFlags(args, FLAG_DEFS);
191
-
192
- const subcommand = positional[0];
193
- if (!subcommand) {
194
- throw new ValidationError(
195
- `Missing subcommand. Usage: sdtk runtime <${SUBCOMMANDS.join("|")}> [options]`
196
- );
197
- }
198
-
199
- if (!SUBCOMMANDS.includes(subcommand)) {
200
- throw new ValidationError(
201
- `Unknown subcommand: "${subcommand}". Must be one of: ${SUBCOMMANDS.join(", ")}`
202
- );
203
- }
204
-
205
- switch (subcommand) {
206
- case "install":
207
- return cmdRuntimeInstall(flags);
208
- case "uninstall":
209
- return cmdRuntimeUninstall(flags);
210
- case "status":
211
- return cmdRuntimeStatus(flags);
212
- }
213
- }
214
-
215
- module.exports = {
216
- cmdRuntime,
217
- };
package/src/index.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- const { cmdHelp } = require("./commands/help");
4
- const { cmdInit } = require("./commands/init");
5
- const { cmdAuth } = require("./commands/auth");
6
- const { cmdGenerate } = require("./commands/generate");
7
- const { cmdRuntime } = require("./commands/runtime");
8
- const { ValidationError, CliError } = require("./lib/errors");
9
-
10
- function getVersion() {
11
- const pkg = require("../package.json");
12
- return pkg.version;
13
- }
14
-
15
- function parseCommand(argv) {
16
- if (!argv || argv.length === 0) {
17
- return { command: "help", args: [] };
18
- }
19
- const [first, ...rest] = argv;
20
- if (first === "-h" || first === "--help") {
21
- return { command: "help", args: [] };
22
- }
23
- if (first === "-v" || first === "--version") {
24
- return { command: "version", args: [] };
25
- }
26
- return { command: first, args: rest };
27
- }
28
-
29
- const COMMANDS = new Set(["help", "version", "init", "auth", "generate", "runtime"]);
30
-
31
- async function run(argv) {
32
- const { command, args } = parseCommand(argv);
33
-
34
- if (!COMMANDS.has(command)) {
35
- throw new ValidationError(
36
- `Unknown command: "${command}". Run "sdtk --help" for available commands.`
37
- );
38
- }
39
-
40
- switch (command) {
41
- case "help":
42
- return cmdHelp();
43
- case "version":
44
- console.log(`sdtk-kit ${getVersion()}`);
45
- return 0;
46
- case "init":
47
- return cmdInit(args);
48
- case "auth":
49
- return cmdAuth(args);
50
- case "generate":
51
- return cmdGenerate(args);
52
- case "runtime":
53
- return cmdRuntime(args);
54
- }
55
- }
56
-
57
- module.exports = {
58
- run,
59
- };