sdtk-code-kit 0.1.2 → 0.1.3

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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.1.2",
3
- "sourceCommit": "60631227236ee508bf17b07dda24d5a10a0f5500",
2
+ "version": "0.1.3",
3
+ "sourceCommit": "fdd187d89b2749677696e024600d94270a2fd8e2",
4
4
  "fileCount": 28,
5
5
  "files": [
6
6
  {
@@ -10,8 +10,8 @@
10
10
  },
11
11
  {
12
12
  "path": "toolkit/install.ps1",
13
- "sha256": "4500fee93ba7f50f66d599f9b1ca63066698d129ea3639f699e9ea3b4255e15d",
14
- "size": 2755
13
+ "sha256": "edfb6675837922681acba3a28cf15526acb1f56992f13c0d61856aff23156687",
14
+ "size": 4115
15
15
  },
16
16
  {
17
17
  "path": "toolkit/scripts/install-claude-skills.ps1",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  {
37
37
  "path": "toolkit/sdtk-spec.config.json",
38
- "sha256": "04122c6d6c4de38d3b8dae890b95523aef6646a46b95c9b979852f2e123e753c",
39
- "size": 113
38
+ "sha256": "2952fcbb9e75a2406cf9edb0de0582a79757e87ce5d9004e9b132ab65583bb26",
39
+ "size": 119
40
40
  },
41
41
  {
42
42
  "path": "toolkit/sdtk-spec.config.profiles.example.json",
@@ -1,10 +1,10 @@
1
1
  6bd495507c8b5e7a8f6a4f04623e7eccc69ee9a6f907c48e3d5a6c4cdc76bfc8 toolkit/AGENTS.md
2
- 4500fee93ba7f50f66d599f9b1ca63066698d129ea3639f699e9ea3b4255e15d toolkit/install.ps1
2
+ edfb6675837922681acba3a28cf15526acb1f56992f13c0d61856aff23156687 toolkit/install.ps1
3
3
  720990cc979cdbca776bbe21eaeee0a73c5dd698ac6c8df430c7f22826ec9219 toolkit/scripts/install-claude-skills.ps1
4
4
  7d61249db7eee6185e5454f7427b808c79d5e564e0d2214ee5f92fa105effb04 toolkit/scripts/install-codex-skills.ps1
5
5
  148ddfc5a79a9dd6d7fa5b926c5511a5e4d458fa31003217cdc2eefcbe966cc2 toolkit/scripts/uninstall-claude-skills.ps1
6
6
  0fd11650bd445fad37c728471872b99bfb8bd17dfb95e62431ceccfad7f0852f toolkit/scripts/uninstall-codex-skills.ps1
7
- 04122c6d6c4de38d3b8dae890b95523aef6646a46b95c9b979852f2e123e753c toolkit/sdtk-spec.config.json
7
+ 2952fcbb9e75a2406cf9edb0de0582a79757e87ce5d9004e9b132ab65583bb26 toolkit/sdtk-spec.config.json
8
8
  e690255217a8b276c1d9bd3714e2cda9d92c0fac703bc955b9280e1b698e2d04 toolkit/sdtk-spec.config.profiles.example.json
9
9
  d797d707dc34d299dbac13f09f3bc8cc42759cb69a9fa5b2cb2269e4c246061e toolkit/skills/code-brainstorm/SKILL.md
10
10
  698c89de9a0586e83ee52147adf345fa2ab813a06b454ca50e9c69e423f0a910 toolkit/skills/code-debug/references/root-cause-tracing.md
@@ -1,119 +1,156 @@
1
- param(
2
- [Parameter(Mandatory = $true)]
3
- [ValidateSet('codex', 'claude')]
4
- [string]$Runtime,
5
-
6
- [string]$ProjectPath,
7
-
8
- [ValidateSet('project', 'user', '')]
9
- [string]$Scope = '',
10
-
11
- [switch]$Force,
12
- [switch]$SkipRuntimeAssets,
13
- [switch]$SkipSkills,
14
- [switch]$Quiet
15
- )
16
-
17
- $ErrorActionPreference = 'Stop'
18
- Set-StrictMode -Version Latest
19
-
20
- function Copy-File {
21
- param(
22
- [Parameter(Mandatory = $true)][string]$SourcePath,
23
- [Parameter(Mandatory = $true)][string]$DestinationPath,
24
- [Parameter(Mandatory = $true)][bool]$Overwrite
25
- )
26
-
27
- if (-not (Test-Path -LiteralPath $SourcePath)) {
28
- throw "Missing source file: $SourcePath"
29
- }
30
-
31
- if ((Test-Path -LiteralPath $DestinationPath) -and -not $Overwrite) {
32
- if (-not $Quiet) {
33
- Write-Warning "Already exists (skipping). Use -Force to overwrite: $DestinationPath"
34
- }
35
- return
36
- }
37
-
38
- $parent = Split-Path -Parent $DestinationPath
39
- if ($parent -and -not (Test-Path -LiteralPath $parent)) {
40
- New-Item -ItemType Directory -Force -Path $parent | Out-Null
41
- }
42
-
43
- Copy-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force
44
- }
45
-
46
- $toolkitRoot = (Resolve-Path -LiteralPath $PSScriptRoot).Path
47
- if (-not $ProjectPath) {
48
- $ProjectPath = (Get-Location).Path
49
- }
50
- $projectRoot = (Resolve-Path -LiteralPath $ProjectPath).Path
51
-
52
- if (-not $Scope) {
53
- $Scope = if ($Runtime -eq 'claude') { 'project' } else { 'user' }
54
- }
55
-
56
- if ($SkipSkills) {
57
- if (-not $Quiet) {
58
- Write-Warning "-SkipSkills is deprecated. Use -SkipRuntimeAssets instead."
59
- }
60
- $SkipRuntimeAssets = $true
61
- }
62
-
63
- if (-not $Quiet) {
64
- Write-Host "SDTK-CODE installer"
65
- Write-Host " Runtime: $Runtime"
66
- Write-Host " Scope: $Scope"
67
- Write-Host " Project: $projectRoot"
68
- Write-Host ""
69
- }
70
-
71
- $sharedFiles = @(
72
- 'AGENTS.md',
73
- 'sdtk-spec.config.json',
74
- 'sdtk-spec.config.profiles.example.json'
75
- )
76
-
77
- foreach ($fileName in $sharedFiles) {
78
- Copy-File `
79
- -SourcePath (Join-Path $toolkitRoot $fileName) `
80
- -DestinationPath (Join-Path $projectRoot $fileName) `
81
- -Overwrite ([bool]$Force)
82
-
83
- if (-not $Quiet) {
84
- Write-Host " [OK] $fileName"
85
- }
86
- }
87
-
88
- if (-not $SkipRuntimeAssets) {
89
- $scriptPath = if ($Runtime -eq 'claude') {
90
- Join-Path $toolkitRoot 'scripts/install-claude-skills.ps1'
91
- } else {
92
- Join-Path $toolkitRoot 'scripts/install-codex-skills.ps1'
93
- }
94
-
95
- if (-not (Test-Path -LiteralPath $scriptPath)) {
96
- throw "Missing runtime installer: $scriptPath"
97
- }
98
-
99
- if (-not $Quiet) {
100
- Write-Host ""
101
- Write-Host "Installing $Runtime runtime assets..."
102
- }
103
-
104
- $params = @{
105
- Scope = $Scope
106
- ProjectPath = $projectRoot
107
- Quiet = [bool]$Quiet
108
- }
109
- if ($Force) {
110
- $params.Force = $true
111
- }
112
-
113
- & $scriptPath @params
114
- }
115
-
116
- if (-not $Quiet) {
117
- Write-Host ""
118
- Write-Host "SDTK-CODE installation complete."
119
- }
1
+ param(
2
+ [Parameter(Mandatory = $true)]
3
+ [ValidateSet('codex', 'claude')]
4
+ [string]$Runtime,
5
+
6
+ [string]$ProjectPath,
7
+
8
+ [ValidateSet('project', 'user', '')]
9
+ [string]$Scope = '',
10
+
11
+ [switch]$Force,
12
+ [switch]$SkipRuntimeAssets,
13
+ [switch]$SkipSkills,
14
+ [switch]$Quiet
15
+ )
16
+
17
+ $ErrorActionPreference = 'Stop'
18
+ Set-StrictMode -Version Latest
19
+
20
+ function Copy-File {
21
+ param(
22
+ [Parameter(Mandatory = $true)][string]$SourcePath,
23
+ [Parameter(Mandatory = $true)][string]$DestinationPath,
24
+ [Parameter(Mandatory = $true)][bool]$Overwrite
25
+ )
26
+
27
+ if (-not (Test-Path -LiteralPath $SourcePath)) {
28
+ throw "Missing source file: $SourcePath"
29
+ }
30
+
31
+ if ((Test-Path -LiteralPath $DestinationPath) -and -not $Overwrite) {
32
+ if (-not $Quiet) {
33
+ Write-Warning "Already exists (skipping). Use -Force to overwrite: $DestinationPath"
34
+ }
35
+ return
36
+ }
37
+
38
+ $parent = Split-Path -Parent $DestinationPath
39
+ if ($parent -and -not (Test-Path -LiteralPath $parent)) {
40
+ New-Item -ItemType Directory -Force -Path $parent | Out-Null
41
+ }
42
+
43
+ Copy-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force
44
+ }
45
+
46
+ function Test-IsMaintainerRoot {
47
+ param(
48
+ [Parameter(Mandatory = $true)][string]$ProjectRoot,
49
+ [Parameter(Mandatory = $true)][string[]]$Markers
50
+ )
51
+
52
+ foreach ($marker in $Markers) {
53
+ if (-not (Test-Path -LiteralPath (Join-Path $ProjectRoot $marker))) {
54
+ return $false
55
+ }
56
+ }
57
+
58
+ return $true
59
+ }
60
+
61
+ function Get-MaintainerRootInstallMessage {
62
+ param(
63
+ [Parameter(Mandatory = $true)][string]$ProjectRoot
64
+ )
65
+
66
+ return @(
67
+ "Refusing to install managed project files into the SDTK maintainer repo root: $ProjectRoot"
68
+ "This install flow would overwrite repo-owned files such as AGENTS.md, CODEX.md, CLAUDE.md, sdtk-spec.config.json, sdtk-spec.config.profiles.example.json."
69
+ "Target a consumer project path instead of the SDTK maintainer monorepo root."
70
+ "If you only need runtime assets, install them into a separate consumer project path rather than the maintainer repo root."
71
+ ) -join "`n"
72
+ }
73
+
74
+ $toolkitRoot = (Resolve-Path -LiteralPath $PSScriptRoot).Path
75
+ if (-not $ProjectPath) {
76
+ $ProjectPath = (Get-Location).Path
77
+ }
78
+ $projectRoot = (Resolve-Path -LiteralPath $ProjectPath).Path
79
+
80
+ $maintainerRootMarkers = @(
81
+ 'governance/ai/core/IMPROVEMENT_BACKLOG.md',
82
+ 'products/sdtk-code/toolkit/install.ps1'
83
+ )
84
+
85
+ if (Test-IsMaintainerRoot -ProjectRoot $projectRoot -Markers $maintainerRootMarkers) {
86
+ throw (Get-MaintainerRootInstallMessage -ProjectRoot $projectRoot)
87
+ }
88
+
89
+ if (-not $Scope) {
90
+ $Scope = if ($Runtime -eq 'claude') { 'project' } else { 'user' }
91
+ }
92
+
93
+ if ($SkipSkills) {
94
+ if (-not $Quiet) {
95
+ Write-Warning "-SkipSkills is deprecated. Use -SkipRuntimeAssets instead."
96
+ }
97
+ $SkipRuntimeAssets = $true
98
+ }
99
+
100
+ if (-not $Quiet) {
101
+ Write-Host "SDTK-CODE installer"
102
+ Write-Host " Runtime: $Runtime"
103
+ Write-Host " Scope: $Scope"
104
+ Write-Host " Project: $projectRoot"
105
+ Write-Host ""
106
+ }
107
+
108
+ $sharedFiles = @(
109
+ 'AGENTS.md',
110
+ 'sdtk-spec.config.json',
111
+ 'sdtk-spec.config.profiles.example.json'
112
+ )
113
+
114
+ foreach ($fileName in $sharedFiles) {
115
+ Copy-File `
116
+ -SourcePath (Join-Path $toolkitRoot $fileName) `
117
+ -DestinationPath (Join-Path $projectRoot $fileName) `
118
+ -Overwrite ([bool]$Force)
119
+
120
+ if (-not $Quiet) {
121
+ Write-Host " [OK] $fileName"
122
+ }
123
+ }
124
+
125
+ if (-not $SkipRuntimeAssets) {
126
+ $scriptPath = if ($Runtime -eq 'claude') {
127
+ Join-Path $toolkitRoot 'scripts/install-claude-skills.ps1'
128
+ } else {
129
+ Join-Path $toolkitRoot 'scripts/install-codex-skills.ps1'
130
+ }
131
+
132
+ if (-not (Test-Path -LiteralPath $scriptPath)) {
133
+ throw "Missing runtime installer: $scriptPath"
134
+ }
135
+
136
+ if (-not $Quiet) {
137
+ Write-Host ""
138
+ Write-Host "Installing $Runtime runtime assets..."
139
+ }
140
+
141
+ $params = @{
142
+ Scope = $Scope
143
+ ProjectPath = $projectRoot
144
+ Quiet = [bool]$Quiet
145
+ }
146
+ if ($Force) {
147
+ $params.Force = $true
148
+ }
149
+
150
+ & $scriptPath @params
151
+ }
152
+
153
+ if (-not $Quiet) {
154
+ Write-Host ""
155
+ Write-Host "SDTK-CODE installation complete."
156
+ }
@@ -1,6 +1,6 @@
1
- {
2
- "toolkit": "SDTK-CODE",
3
- "version": "0.1.2",
4
- "skills_path": "toolkit/skills",
5
- "skill_prefix": "code-"
6
- }
1
+ {
2
+ "toolkit": "SDTK-CODE",
3
+ "version": "0.1.3",
4
+ "skills_path": "toolkit/skills",
5
+ "skill_prefix": "code-"
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdtk-code-kit",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Workflow-first coding process toolkit: start, plan, build, verify, ship, and runtime setup.",
5
5
  "bin": {
6
6
  "sdtk-code": "./bin/sdtk-code.js"
@@ -134,6 +134,8 @@ function cmdHelp() {
134
134
  " --skip-project-files Skip sdtk-code init --force during update",
135
135
  " --skip-runtime-assets Skip sdtk-code runtime install --force during update",
136
136
  " --verbose Show detailed command output",
137
+ " Maintainer-root guard: init/update refuse the SDTK maintainer monorepo root as a managed project target.",
138
+ " Use a consumer project path, or use --skip-project-files when update should avoid project-file refresh.",
137
139
  "",
138
140
  "Runtime options:",
139
141
  " --runtime <codex|claude> Target runtime (required)",
@@ -1,95 +1,98 @@
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
- const runtime = flags.runtime || "codex";
26
- validateChoice(runtime, VALID_RUNTIMES, "runtime");
27
-
28
- const scope = flags["runtime-scope"] || defaultScope(runtime);
29
- validateChoice(scope, VALID_SCOPES, "runtime-scope");
30
- if (scope === "project" && !isProjectScopeSupported(runtime)) {
31
- throw new ValidationError(
32
- `${runtime} does not support project-local runtime assets. Use --runtime-scope user instead.`
33
- );
34
- }
35
-
36
- const skipAssets = flags["skip-runtime-assets"] || flags["skip-skills"];
37
- if (flags["skip-skills"] && !flags["skip-runtime-assets"]) {
38
- console.warn("Warning: --skip-skills is deprecated. Use --skip-runtime-assets instead.");
39
- }
40
-
41
- const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
42
-
43
- verify();
44
-
45
- const installScript = resolvePayloadFile("toolkit/install.ps1");
46
- const params = {
47
- ProjectPath: projectPath,
48
- Runtime: runtime,
49
- Scope: scope,
50
- };
51
- if (flags.force) {
52
- params.Force = true;
53
- }
54
- if (skipAssets) {
55
- params.SkipRuntimeAssets = true;
56
- }
57
- if (!flags.verbose) {
58
- params.Quiet = true;
59
- }
60
-
61
- console.log("Initializing SDTK-CODE workspace...");
62
- console.log(` Runtime: ${runtime}`);
63
- console.log(` Scope: ${scope}`);
64
- console.log(` Project: ${projectPath}`);
65
- if (runtime === "codex" && scope === "project") {
66
- console.log(` Codex home contract: ${path.join(projectPath, ".codex")}`);
67
- console.log(" Note: Launch Codex with CODEX_HOME=<project>/.codex to use project-local skills.");
68
- console.log(" Note: This CLI does not claim native .codex/skills auto-discovery.");
69
- }
70
- console.log("");
71
-
72
- const result = await runScript(installScript, params, { silent: !flags.verbose });
73
- if (result.exitCode !== 0) {
74
- if (result.stderr) {
75
- console.error(result.stderr);
76
- }
77
- throw new ValidationError(`Initialization failed (exit code ${result.exitCode}).`);
78
- }
79
-
80
- console.log("");
81
- console.log("SDTK-CODE workspace initialized successfully.");
82
- if (runtime === "codex" && scope === "project") {
83
- console.log(`Project-local Codex skills were installed into ${path.join(projectPath, ".codex", "skills")}.`);
84
- console.log("Launch Codex with CODEX_HOME=<project>/.codex to activate that local runtime home.");
85
- }
86
- console.log("");
87
- console.log("Next steps:");
88
- console.log(" 1. Review and customize sdtk-spec.config.json for your project stack.");
89
- console.log(" 2. Start the workflow with sdtk-code start once the upstream SDTK-SPEC handoff is ready.");
90
- return 0;
91
- }
92
-
93
- module.exports = {
94
- cmdInit,
95
- };
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
+ const { assertProjectRefreshTargetAllowed } = require("../lib/project-target-guard");
10
+
11
+ const FLAG_DEFS = {
12
+ runtime: { type: "string" },
13
+ "project-path": { type: "string" },
14
+ "runtime-scope": { type: "string" },
15
+ force: { type: "boolean" },
16
+ "skip-skills": { type: "boolean" },
17
+ "skip-runtime-assets": { type: "boolean" },
18
+ verbose: { type: "boolean" },
19
+ };
20
+
21
+ const VALID_RUNTIMES = ["codex", "claude"];
22
+
23
+ async function cmdInit(args) {
24
+ const { flags } = parseFlags(args, FLAG_DEFS);
25
+
26
+ const runtime = flags.runtime || "codex";
27
+ validateChoice(runtime, VALID_RUNTIMES, "runtime");
28
+
29
+ const scope = flags["runtime-scope"] || defaultScope(runtime);
30
+ validateChoice(scope, VALID_SCOPES, "runtime-scope");
31
+ if (scope === "project" && !isProjectScopeSupported(runtime)) {
32
+ throw new ValidationError(
33
+ `${runtime} does not support project-local runtime assets. Use --runtime-scope user instead.`
34
+ );
35
+ }
36
+
37
+ const skipAssets = flags["skip-runtime-assets"] || flags["skip-skills"];
38
+ if (flags["skip-skills"] && !flags["skip-runtime-assets"]) {
39
+ console.warn("Warning: --skip-skills is deprecated. Use --skip-runtime-assets instead.");
40
+ }
41
+
42
+ const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
43
+
44
+ assertProjectRefreshTargetAllowed("sdtk-code", "init", projectPath);
45
+
46
+ verify();
47
+
48
+ const installScript = resolvePayloadFile("toolkit/install.ps1");
49
+ const params = {
50
+ ProjectPath: projectPath,
51
+ Runtime: runtime,
52
+ Scope: scope,
53
+ };
54
+ if (flags.force) {
55
+ params.Force = true;
56
+ }
57
+ if (skipAssets) {
58
+ params.SkipRuntimeAssets = true;
59
+ }
60
+ if (!flags.verbose) {
61
+ params.Quiet = true;
62
+ }
63
+
64
+ console.log("Initializing SDTK-CODE workspace...");
65
+ console.log(` Runtime: ${runtime}`);
66
+ console.log(` Scope: ${scope}`);
67
+ console.log(` Project: ${projectPath}`);
68
+ if (runtime === "codex" && scope === "project") {
69
+ console.log(` Codex home contract: ${path.join(projectPath, ".codex")}`);
70
+ console.log(" Note: Launch Codex with CODEX_HOME=<project>/.codex to use project-local skills.");
71
+ console.log(" Note: This CLI does not claim native .codex/skills auto-discovery.");
72
+ }
73
+ console.log("");
74
+
75
+ const result = await runScript(installScript, params, { silent: !flags.verbose });
76
+ if (result.exitCode !== 0) {
77
+ if (result.stderr) {
78
+ console.error(result.stderr);
79
+ }
80
+ throw new ValidationError(`Initialization failed (exit code ${result.exitCode}).`);
81
+ }
82
+
83
+ console.log("");
84
+ console.log("SDTK-CODE workspace initialized successfully.");
85
+ if (runtime === "codex" && scope === "project") {
86
+ console.log(`Project-local Codex skills were installed into ${path.join(projectPath, ".codex", "skills")}.`);
87
+ console.log("Launch Codex with CODEX_HOME=<project>/.codex to activate that local runtime home.");
88
+ }
89
+ console.log("");
90
+ console.log("Next steps:");
91
+ console.log(" 1. Review and customize sdtk-spec.config.json for your project stack.");
92
+ console.log(" 2. Start the workflow with sdtk-code start once the upstream SDTK-SPEC handoff is ready.");
93
+ return 0;
94
+ }
95
+
96
+ module.exports = {
97
+ cmdInit,
98
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const { ValidationError } = require("./errors");
6
+
7
+ const MAINTAINER_ROOT_MARKERS = [
8
+ "governance/ai/core/IMPROVEMENT_BACKLOG.md",
9
+ "products/sdtk-code/toolkit/install.ps1",
10
+ ];
11
+ const PROTECTED_FILES = [
12
+ "AGENTS.md",
13
+ "CODEX.md",
14
+ "CLAUDE.md",
15
+ "sdtk-spec.config.json",
16
+ "sdtk-spec.config.profiles.example.json"
17
+ ];
18
+
19
+ function isMaintainerRoot(projectPath) {
20
+ const resolved = path.resolve(projectPath);
21
+ return MAINTAINER_ROOT_MARKERS.every((marker) => fs.existsSync(path.join(resolved, marker)));
22
+ }
23
+
24
+ function buildMaintainerRootMessage(cliName, action, projectPath) {
25
+ const lines = [
26
+ `Refusing to refresh managed project files into the SDTK maintainer repo root: ${projectPath}`,
27
+ `The ${action} flow would overwrite repo-owned files such as ${PROTECTED_FILES.join(", ")}.`,
28
+ "Target a consumer project path instead of the SDTK maintainer monorepo root.",
29
+ ];
30
+
31
+ if (action === "update") {
32
+ lines.push(`If you only need package/runtime refresh, rerun ${cliName} update with --skip-project-files.`);
33
+ } else {
34
+ lines.push(`If you only need runtime assets, use ${cliName} runtime install against the desired consumer project path instead of ${cliName} init.`);
35
+ }
36
+
37
+ return lines.join("\n");
38
+ }
39
+
40
+ function assertProjectRefreshTargetAllowed(cliName, action, projectPath) {
41
+ if (!isMaintainerRoot(projectPath)) {
42
+ return;
43
+ }
44
+
45
+ throw new ValidationError(buildMaintainerRootMessage(cliName, action, projectPath));
46
+ }
47
+
48
+ module.exports = {
49
+ assertProjectRefreshTargetAllowed,
50
+ buildMaintainerRootMessage,
51
+ isMaintainerRoot,
52
+ };
53
+
package/src/lib/update.js CHANGED
@@ -5,6 +5,7 @@ const { spawn } = require("child_process");
5
5
  const { parseFlags, validateChoice } = require("./args");
6
6
  const { CliError, DependencyError, ValidationError } = require("./errors");
7
7
  const { VALID_SCOPES, defaultScope, isProjectScopeSupported } = require("./scope");
8
+ const { assertProjectRefreshTargetAllowed } = require("./project-target-guard");
8
9
 
9
10
  const PACKAGE_NAME = "sdtk-code-kit";
10
11
  const CLI_NAME = "sdtk-code";
@@ -233,11 +234,17 @@ function parseUpdateOptions(args) {
233
234
  }
234
235
  }
235
236
 
237
+ const projectPath = path.resolve(flags["project-path"] || process.cwd());
238
+
239
+ if (runtime && !flags["skip-project-files"]) {
240
+ assertProjectRefreshTargetAllowed("sdtk-code", "update", projectPath);
241
+ }
242
+
236
243
  return {
237
244
  requestedVersion,
238
245
  runtime,
239
246
  scope,
240
- projectPath: path.resolve(flags["project-path"] || process.cwd()),
247
+ projectPath,
241
248
  checkOnly: flags["check-only"],
242
249
  skipProjectFiles: flags["skip-project-files"],
243
250
  skipRuntimeAssets: flags["skip-runtime-assets"],