@simplysm/sd-claude 14.0.47 → 14.0.49

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 (130) hide show
  1. package/{claude/references/sd-simplysm14/sd-claude/usage.md → README.md} +2 -2
  2. package/claude/rules/sd-claude-rules.md +25 -10
  3. package/claude/rules/sd-options.md +11 -6
  4. package/claude/sd-subagent-start.sh +6 -0
  5. package/claude/settings.json +1 -12
  6. package/claude/skills/sd-check/SKILL.md +43 -12
  7. package/claude/skills/sd-claude-docs/SKILL.md +30 -58
  8. package/claude/skills/sd-claude-docs/references/package-claudemd.md +12 -0
  9. package/claude/skills/sd-claude-docs/references/package-doc-gen.md +26 -13
  10. package/claude/skills/sd-commit/SKILL.md +1 -1
  11. package/claude/skills/sd-debug/SKILL.md +5 -3
  12. package/claude/skills/sd-deliverable/SKILL.md +1 -1
  13. package/claude/skills/sd-dev/SKILL.md +14 -9
  14. package/claude/skills/sd-doc-extract/SKILL.md +8 -10
  15. package/claude/skills/sd-doc-extract/_common.py +8 -1
  16. package/claude/skills/sd-doc-extract/_extract_docx.py +74 -34
  17. package/claude/skills/sd-doc-extract/_extract_pdf.py +12 -1
  18. package/claude/skills/sd-doc-extract/_extract_pptx.py +103 -23
  19. package/claude/skills/sd-doc-extract/_extract_xlsb.py +93 -4
  20. package/claude/skills/sd-doc-extract/_extract_xlsx.py +98 -36
  21. package/claude/skills/sd-doc-extract/extract.py +22 -3
  22. package/claude/skills/sd-inner-clarify/SKILL.md +78 -0
  23. package/claude/skills/sd-inner-debug/SKILL.md +1 -1
  24. package/claude/skills/sd-inner-review/SKILL.md +13 -0
  25. package/claude/skills/sd-issue/SKILL.md +1 -1
  26. package/claude/skills/sd-outlook/SKILL.md +1 -1
  27. package/claude/skills/sd-plan/SKILL.md +50 -17
  28. package/claude/skills/sd-prompt/SKILL.md +180 -178
  29. package/claude/skills/sd-prompt/references/eval-runner.md +5 -30
  30. package/claude/skills/sd-prompt/references/sd-eval-env-template.md +23 -0
  31. package/claude/skills/sd-refactor/SKILL.md +2 -2
  32. package/claude/skills/sd-tdd/SKILL.md +45 -16
  33. package/claude/skills/sd-use/SKILL.md +84 -80
  34. package/claude/skills/sd-wbs/SKILL.md +84 -27
  35. package/{claude/references/sd-simplysm14/sd-claude/docs → docs}/assets.md +2 -3
  36. package/{claude/references/sd-simplysm14/sd-claude/docs → docs}/hooks.md +7 -6
  37. package/{claude/references/sd-simplysm14/sd-claude/docs → docs}/scripts.md +1 -9
  38. package/package.json +3 -2
  39. package/scripts/sync.mjs +4 -2
  40. package/claude/references/sd-simplysm14/angular/docs/bootstrap.md +0 -48
  41. package/claude/references/sd-simplysm14/angular/docs/directives.md +0 -236
  42. package/claude/references/sd-simplysm14/angular/docs/features.md +0 -379
  43. package/claude/references/sd-simplysm14/angular/docs/pipes.md +0 -32
  44. package/claude/references/sd-simplysm14/angular/docs/plugins.md +0 -37
  45. package/claude/references/sd-simplysm14/angular/docs/provider-types.md +0 -283
  46. package/claude/references/sd-simplysm14/angular/docs/providers.md +0 -379
  47. package/claude/references/sd-simplysm14/angular/docs/styling.md +0 -222
  48. package/claude/references/sd-simplysm14/angular/docs/type-utilities.md +0 -250
  49. package/claude/references/sd-simplysm14/angular/docs/ui-data.md +0 -275
  50. package/claude/references/sd-simplysm14/angular/docs/ui-form.md +0 -490
  51. package/claude/references/sd-simplysm14/angular/docs/ui-layout.md +0 -140
  52. package/claude/references/sd-simplysm14/angular/docs/ui-navigation.md +0 -273
  53. package/claude/references/sd-simplysm14/angular/docs/ui-overlay.md +0 -157
  54. package/claude/references/sd-simplysm14/angular/docs/ui-visual.md +0 -127
  55. package/claude/references/sd-simplysm14/angular/docs/utils.md +0 -295
  56. package/claude/references/sd-simplysm14/angular/usage.md +0 -489
  57. package/claude/references/sd-simplysm14/capacitor-plugin-auto-update/usage.md +0 -182
  58. package/claude/references/sd-simplysm14/capacitor-plugin-file-system/docs/file-operations.md +0 -154
  59. package/claude/references/sd-simplysm14/capacitor-plugin-file-system/docs/permissions.md +0 -84
  60. package/claude/references/sd-simplysm14/capacitor-plugin-file-system/docs/storage-paths.md +0 -107
  61. package/claude/references/sd-simplysm14/capacitor-plugin-file-system/docs/types.md +0 -83
  62. package/claude/references/sd-simplysm14/capacitor-plugin-file-system/usage.md +0 -133
  63. package/claude/references/sd-simplysm14/capacitor-plugin-intent/usage.md +0 -203
  64. package/claude/references/sd-simplysm14/capacitor-plugin-usb-storage/usage.md +0 -258
  65. package/claude/references/sd-simplysm14/core-browser/usage.md +0 -306
  66. package/claude/references/sd-simplysm14/core-common/docs/errors.md +0 -82
  67. package/claude/references/sd-simplysm14/core-common/docs/extensions.md +0 -167
  68. package/claude/references/sd-simplysm14/core-common/docs/features.md +0 -136
  69. package/claude/references/sd-simplysm14/core-common/docs/types.md +0 -245
  70. package/claude/references/sd-simplysm14/core-common/docs/utils.md +0 -591
  71. package/claude/references/sd-simplysm14/core-common/usage.md +0 -255
  72. package/claude/references/sd-simplysm14/core-node/docs/child-process.md +0 -182
  73. package/claude/references/sd-simplysm14/core-node/docs/features.md +0 -214
  74. package/claude/references/sd-simplysm14/core-node/docs/file-system.md +0 -509
  75. package/claude/references/sd-simplysm14/core-node/docs/file-watching.md +0 -139
  76. package/claude/references/sd-simplysm14/core-node/docs/logging.md +0 -180
  77. package/claude/references/sd-simplysm14/core-node/docs/path.md +0 -176
  78. package/claude/references/sd-simplysm14/core-node/docs/utilities-cpx.md +0 -194
  79. package/claude/references/sd-simplysm14/core-node/docs/utilities-fsx.md +0 -469
  80. package/claude/references/sd-simplysm14/core-node/docs/utilities-pathx.md +0 -151
  81. package/claude/references/sd-simplysm14/core-node/docs/worker-threads.md +0 -334
  82. package/claude/references/sd-simplysm14/core-node/docs/worker.md +0 -205
  83. package/claude/references/sd-simplysm14/core-node/usage.md +0 -259
  84. package/claude/references/sd-simplysm14/excel/docs/core-classes.md +0 -453
  85. package/claude/references/sd-simplysm14/excel/docs/types.md +0 -459
  86. package/claude/references/sd-simplysm14/excel/docs/utilities.md +0 -194
  87. package/claude/references/sd-simplysm14/excel/docs/wrapper.md +0 -73
  88. package/claude/references/sd-simplysm14/excel/usage.md +0 -134
  89. package/claude/references/sd-simplysm14/lint/usage.md +0 -130
  90. package/claude/references/sd-simplysm14/orm-common/docs/core.md +0 -188
  91. package/claude/references/sd-simplysm14/orm-common/docs/expression.md +0 -190
  92. package/claude/references/sd-simplysm14/orm-common/docs/models.md +0 -17
  93. package/claude/references/sd-simplysm14/orm-common/docs/query-builder.md +0 -97
  94. package/claude/references/sd-simplysm14/orm-common/docs/queryable-executable.md +0 -250
  95. package/claude/references/sd-simplysm14/orm-common/docs/schema-builders.md +0 -364
  96. package/claude/references/sd-simplysm14/orm-common/docs/types.md +0 -522
  97. package/claude/references/sd-simplysm14/orm-common/usage.md +0 -229
  98. package/claude/references/sd-simplysm14/orm-node/docs/connections.md +0 -137
  99. package/claude/references/sd-simplysm14/orm-node/docs/core.md +0 -131
  100. package/claude/references/sd-simplysm14/orm-node/docs/types.md +0 -173
  101. package/claude/references/sd-simplysm14/orm-node/usage.md +0 -143
  102. package/claude/references/sd-simplysm14/sd-cli/usage.md +0 -782
  103. package/claude/references/sd-simplysm14/service-client/docs/features.md +0 -217
  104. package/claude/references/sd-simplysm14/service-client/docs/main.md +0 -148
  105. package/claude/references/sd-simplysm14/service-client/docs/protocol.md +0 -53
  106. package/claude/references/sd-simplysm14/service-client/docs/transport.md +0 -131
  107. package/claude/references/sd-simplysm14/service-client/docs/types.md +0 -129
  108. package/claude/references/sd-simplysm14/service-client/usage.md +0 -202
  109. package/claude/references/sd-simplysm14/service-common/docs/app-structure.md +0 -175
  110. package/claude/references/sd-simplysm14/service-common/docs/events.md +0 -64
  111. package/claude/references/sd-simplysm14/service-common/docs/protocol.md +0 -331
  112. package/claude/references/sd-simplysm14/service-common/docs/service-types.md +0 -90
  113. package/claude/references/sd-simplysm14/service-common/docs/types.md +0 -19
  114. package/claude/references/sd-simplysm14/service-common/usage.md +0 -154
  115. package/claude/references/sd-simplysm14/service-server/docs/auth.md +0 -64
  116. package/claude/references/sd-simplysm14/service-server/docs/core.md +0 -174
  117. package/claude/references/sd-simplysm14/service-server/docs/legacy.md +0 -25
  118. package/claude/references/sd-simplysm14/service-server/docs/main.md +0 -88
  119. package/claude/references/sd-simplysm14/service-server/docs/protocol.md +0 -33
  120. package/claude/references/sd-simplysm14/service-server/docs/services.md +0 -94
  121. package/claude/references/sd-simplysm14/service-server/docs/transport-http.md +0 -93
  122. package/claude/references/sd-simplysm14/service-server/docs/transport-socket.md +0 -119
  123. package/claude/references/sd-simplysm14/service-server/docs/types.md +0 -36
  124. package/claude/references/sd-simplysm14/service-server/docs/utils.md +0 -22
  125. package/claude/references/sd-simplysm14/service-server/usage.md +0 -171
  126. package/claude/references/sd-simplysm14/storage/usage.md +0 -301
  127. package/claude/references/sd-simplysm14.md +0 -35
  128. package/claude/rules/sd-clarify.md +0 -23
  129. package/claude/sd-session-start.sh +0 -10
  130. /package/{claude/references/sd-simplysm14/sd-claude/docs → docs}/cli.md +0 -0
@@ -1,180 +0,0 @@
1
- # Logging (consola)
2
-
3
- ## `setupConsola`
4
-
5
- 환경에 따라 consola의 reporter를 자동으로 구성한다.
6
-
7
- ```typescript
8
- export function setupConsola(opts?: SetupConsolaOptions): void
9
- ```
10
-
11
- | Parameter | Type | Description |
12
- |-----------|------|-------------|
13
- | `opts` | SetupConsolaOptions (optional) | 옵션 객체 |
14
-
15
- ### SetupConsolaOptions
16
-
17
- ```typescript
18
- export interface SetupConsolaOptions {
19
- cli?: boolean;
20
- }
21
- ```
22
-
23
- | Field | Type | Description |
24
- |-------|------|-------------|
25
- | `cli` | boolean (optional) | CLI 모드 여부. true이면 프로덕션에서도 PrettyReporter 사용 (기본값: false) |
26
-
27
- ### Behavior by Environment
28
-
29
- | Condition | Reporters | Debug Level |
30
- |-----------|-----------|------------|
31
- | Production (not DEV, not cli) | FileReporter | debug 레벨 포함 |
32
- | Development or cli + SD_DEBUG | PrettyReporter | debug 레벨 포함 |
33
- | Development or cli (일반) | FileReporter + PrettyReporter (info 이하) | debug는 파일에만 기록 |
34
-
35
- **Note**:
36
- - `DEV` 환경변수 또는 `SD_DEBUG` 환경변수의 값을 `parseBoolEnv()`로 파싱한다.
37
- - `env("...")`는 @simplysm/core-common의 함수를 사용한다.
38
-
39
- **Example**:
40
- ```typescript
41
- // 환경별 자동 구성
42
- setupConsola();
43
-
44
- // CLI 모드
45
- setupConsola({ cli: true });
46
- ```
47
-
48
- ---
49
-
50
- ## `withMaxLevel`
51
-
52
- Consola reporter를 지정된 로그 레벨 이하로 제한하는 래퍼.
53
-
54
- ```typescript
55
- export function withMaxLevel(reporter: ConsolaReporter, maxLevel: number): ConsolaReporter
56
- ```
57
-
58
- | Parameter | Type | Description |
59
- |-----------|------|-------------|
60
- | `reporter` | ConsolaReporter | 원본 reporter |
61
- | `maxLevel` | number | 최대 로그 레벨 (LogLevels 상수 참고) |
62
-
63
- **Return**: 제한된 reporter
64
-
65
- **Consola LogLevels**:
66
- ```
67
- 0: fatal
68
- 1: error
69
- 2: warn
70
- 3: info
71
- 4: success
72
- 5: log
73
- 6: debug
74
- 7: trace
75
- ```
76
-
77
- **Example**:
78
- ```typescript
79
- import { withMaxLevel, PrettyReporter, LogLevels } from "@simplysm/core-node";
80
-
81
- // info 레벨 이하만 출력
82
- const limitedReporter = withMaxLevel(new PrettyReporter(), LogLevels.info);
83
- ```
84
-
85
- ---
86
-
87
- ## `PrettyReporter`
88
-
89
- 터미널 출력용 consola reporter.
90
-
91
- 아이콘, 색상, 에러 스택 포맷팅을 지원한다.
92
-
93
- ```typescript
94
- export class PrettyReporter implements ConsolaReporter {
95
- log(logObj: LogObject, ctx: { options: ConsolaOptions }): void
96
- }
97
- ```
98
-
99
- **Features**:
100
- - 로그 레벨별 아이콘 표시
101
- - 컬러 출력
102
- - 에러 객체의 스택 포맷팅
103
- - 타임스탐프 표시 (선택적)
104
-
105
- **Example**:
106
- ```typescript
107
- import { PrettyReporter } from "@simplysm/core-node";
108
- import consola from "consola";
109
-
110
- consola.options.reporters = [new PrettyReporter()];
111
- ```
112
-
113
- ---
114
-
115
- ## `createFileReporter`
116
-
117
- 파일 기반 consola reporter를 생성한다.
118
-
119
- JSON 라인 형식으로 로그를 기록하며, 날짜별 로테이션과 크기 제한을 지원한다.
120
-
121
- ```typescript
122
- export function createFileReporter(options?: FileReporterOptions): ConsolaReporter
123
- ```
124
-
125
- | Parameter | Type | Description |
126
- |-----------|------|-------------|
127
- | `options` | FileReporterOptions (optional) | 옵션 객체 |
128
-
129
- ### FileReporterOptions
130
-
131
- ```typescript
132
- export interface FileReporterOptions {
133
- maxSize?: number; // 로그 파일 최대 크기 (바이트, 기본값: 20MB)
134
- maxDays?: number; // 로그 보관 기간 (일, 기본값: 14일)
135
- }
136
- ```
137
-
138
- | Field | Type | Description |
139
- |-------|------|-------------|
140
- | `maxSize` | number (optional) | 단일 로그 파일의 최대 크기 (바이트). 초과 시 롤오버됨 (기본값: 20MB = 20 * 1024 * 1024) |
141
- | `maxDays` | number (optional) | 로그 파일 보관 기간 (일). 이 기간이 지난 로그는 자동 삭제됨 (기본값: 14) |
142
-
143
- ### Log File Format
144
-
145
- - 디렉토리: `.logs/`
146
- - 파일명 형식: `app.YYYY-MM-DD.log`
147
- - 내용: JSON 라인 (각 로그는 하나의 JSON 객체)
148
-
149
- **Example**:
150
- ```typescript
151
- import { createFileReporter } from "@simplysm/core-node";
152
- import consola from "consola";
153
-
154
- const fileReporter = createFileReporter({
155
- maxSize: 10 * 1024 * 1024, // 10MB
156
- maxDays: 7, // 7일 보관
157
- });
158
-
159
- consola.options.reporters = [fileReporter];
160
- ```
161
-
162
- ---
163
-
164
- ## Integration with setupConsola
165
-
166
- setupConsola()는 내부적으로 PrettyReporter와 createFileReporter()를 사용하여 환경에 맞게 reporters를 구성한다.
167
-
168
- ```typescript
169
- import { setupConsola } from "@simplysm/core-node";
170
- import consola from "consola";
171
-
172
- // 자동 구성
173
- setupConsola();
174
-
175
- // 이후 consola를 정상적으로 사용 가능
176
- consola.info("Application started");
177
- consola.debug("Debug information");
178
- ```
179
-
180
- **주의**: consola는 프로젝트 루트의 `console.*` 금지 규칙을 대체하는 표준 로깅 수단이다.
@@ -1,176 +0,0 @@
1
- # Path (pathx)
2
-
3
- ## `PosixPath`
4
-
5
- POSIX 스타일(슬래시) 경로임을 타입 수준에서 보장하는 브랜드 타입.
6
-
7
- posix() 또는 posixResolve()를 통해서만 생성할 수 있다.
8
-
9
- ```typescript
10
- export type PosixPath = string & {
11
- [POSIX]: never;
12
- }
13
- ```
14
-
15
- **Note**: 일반 문자열을 강제로 PosixPath로 캐스팅할 수 없다. posix() 또는 posixResolve()를 반드시 사용해야 한다.
16
-
17
- ---
18
-
19
- ## `posix`
20
-
21
- 경로를 POSIX 스타일(슬래시)로 변환한다.
22
-
23
- 경로 결합이나 resolve는 수행하지 않으며, 단순히 백슬래시를 슬래시로 바꾼다.
24
-
25
- ```typescript
26
- export function posix(p: string): PosixPath
27
- ```
28
-
29
- | Parameter | Type | Description |
30
- |-----------|------|-------------|
31
- | `p` | string | 변환할 경로 |
32
-
33
- **Return**: PosixPath (슬래시로 정규화된 경로)
34
-
35
- **Example**:
36
- ```typescript
37
- posix("C:\\Users\\test"); // "C:/Users/test"
38
- posix("./relative/path"); // "./relative/path"
39
- ```
40
-
41
- ---
42
-
43
- ## `posixResolve`
44
-
45
- 절대 경로로 resolve한 뒤 POSIX 스타일로 변환한다.
46
-
47
- ```typescript
48
- export function posixResolve(...args: string[]): PosixPath
49
- ```
50
-
51
- | Parameter | Type | Description |
52
- |-----------|------|-------------|
53
- | `...args` | string[] | resolve할 경로 세그먼트 (node:path.resolve와 동일) |
54
-
55
- **Return**: PosixPath (절대 경로, 슬래시로 정규화)
56
-
57
- **Example**:
58
- ```typescript
59
- posixResolve("/base", "sub", "file.txt"); // "/base/sub/file.txt" (Unix 환경)
60
- posixResolve("relative/path"); // "/home/user/relative/path" (절대 경로로 resolve됨)
61
- ```
62
-
63
- ---
64
-
65
- ## `changeFileDirectory`
66
-
67
- 파일 경로의 디렉토리를 변경한다.
68
-
69
- ```typescript
70
- export function changeFileDirectory(
71
- filePath: string,
72
- fromDirectory: string,
73
- toDirectory: string,
74
- ): string
75
- ```
76
-
77
- | Parameter | Type | Description |
78
- |-----------|------|-------------|
79
- | `filePath` | string | 파일 경로 |
80
- | `fromDirectory` | string | 현재 디렉토리 |
81
- | `toDirectory` | string | 새 디렉토리 |
82
-
83
- **Return**: 새 디렉토리로 변경된 파일 경로
84
-
85
- **Throws**: filePath가 fromDirectory 내부에 없는 경우 ArgumentError 발생
86
-
87
- **Example**:
88
- ```typescript
89
- changeFileDirectory("/a/b/c.txt", "/a/b", "/x");
90
- // → "/x/c.txt"
91
-
92
- changeFileDirectory("/a/b/sub/c.txt", "/a/b", "/x");
93
- // → "/x/sub/c.txt"
94
- ```
95
-
96
- ---
97
-
98
- ## `basenameWithoutExt`
99
-
100
- 확장자를 제외한 파일명(basename)을 반환한다.
101
-
102
- ```typescript
103
- export function basenameWithoutExt(filePath: string): string
104
- ```
105
-
106
- | Parameter | Type | Description |
107
- |-----------|------|-------------|
108
- | `filePath` | string | 파일 경로 |
109
-
110
- **Return**: 확장자를 제외한 파일명
111
-
112
- **Example**:
113
- ```typescript
114
- basenameWithoutExt("file.txt"); // "file"
115
- basenameWithoutExt("/path/to/file.spec.ts"); // "file.spec"
116
- basenameWithoutExt("/path/to/file"); // "file"
117
- ```
118
-
119
- ---
120
-
121
- ## `isChildPath`
122
-
123
- childPath가 parentPath의 하위 경로인지 확인한다.
124
-
125
- 동일한 경로이면 false를 반환한다.
126
-
127
- 경로는 내부적으로 posixResolve()를 사용하여 정규화되며, POSIX 슬래시(/)를 구분자로 사용하여 비교한다.
128
-
129
- ```typescript
130
- export function isChildPath(childPath: string, parentPath: string): boolean
131
- ```
132
-
133
- | Parameter | Type | Description |
134
- |-----------|------|-------------|
135
- | `childPath` | string | 자식으로 확인할 경로 |
136
- | `parentPath` | string | 부모로 확인할 경로 |
137
-
138
- **Return**: childPath가 parentPath의 하위 경로이면 true, 동일하거나 상위 경로이면 false
139
-
140
- **Example**:
141
- ```typescript
142
- isChildPath("/a/b/c", "/a/b"); // true
143
- isChildPath("/a/b", "/a/b/c"); // false
144
- isChildPath("/a/b", "/a/b"); // false (동일 경로)
145
- isChildPath("/a/bc", "/a/b"); // false (접두사 매칭이 아님)
146
- ```
147
-
148
- ---
149
-
150
- ## `filterByTargets`
151
-
152
- 대상 경로 목록을 기반으로 파일을 필터링한다.
153
-
154
- 대상 경로와 일치하거나 하위에 있는 파일을 포함한다.
155
-
156
- ```typescript
157
- export function filterByTargets(files: string[], targets: string[], cwd: string): string[]
158
- ```
159
-
160
- | Parameter | Type | Description |
161
- |-----------|------|-------------|
162
- | `files` | string[] | 필터링할 파일 경로 배열. 주의: cwd 하위의 절대 경로여야 한다. cwd 외부의 경로는 상대 경로(../)로 변환되어 처리된다. |
163
- | `targets` | string[] | 대상 경로 (cwd 기준 상대 경로, POSIX 스타일 권장) |
164
- | `cwd` | string | 현재 작업 디렉토리 (절대 경로) |
165
-
166
- **Return**: targets가 비어있으면 files를 그대로 반환; 그렇지 않으면 대상 경로 하위의 파일만 반환
167
-
168
- **Example**:
169
- ```typescript
170
- const files = ["/proj/src/a.ts", "/proj/src/b.ts", "/proj/tests/c.ts"];
171
- filterByTargets(files, ["src"], "/proj");
172
- // → ["/proj/src/a.ts", "/proj/src/b.ts"]
173
-
174
- filterByTargets(files, [], "/proj");
175
- // → ["/proj/src/a.ts", "/proj/src/b.ts", "/proj/tests/c.ts"] (targets가 비어있음)
176
- ```
@@ -1,194 +0,0 @@
1
- # Utilities — cpx
2
-
3
- `cpx`는 `@simplysm/core-node`에서 네임스페이스로 re-export되는 자식 프로세스 실행 유틸리티 모음이다.
4
-
5
- ```typescript
6
- import { cpx } from "@simplysm/core-node";
7
- ```
8
-
9
- ---
10
-
11
- ## `SpawnResult`
12
-
13
- 프로세스 실행 결과.
14
-
15
- ```typescript
16
- export interface SpawnResult {
17
- stdout: string;
18
- stderr: string;
19
- exitCode: number;
20
- }
21
- ```
22
-
23
- | Field | Type | Description |
24
- |-------|------|-------------|
25
- | `stdout` | `string` | 표준 출력 문자열. stdio가 "inherit"이면 빈 문자열 |
26
- | `stderr` | `string` | 표준 에러 문자열. stdio가 "inherit"이면 빈 문자열 |
27
- | `exitCode` | `number` | 프로세스 종료 코드 |
28
-
29
- ---
30
-
31
- ## `SpawnProcess`
32
-
33
- `spawn()`의 반환 타입. `PromiseLike<SpawnResult>`를 구현하여 `await`로 결과를 기다리거나, `kill()`로 프로세스를 종료할 수 있다.
34
-
35
- ```typescript
36
- export class SpawnProcess implements PromiseLike<SpawnResult> {
37
- get pid(): number | undefined;
38
- then(onfulfilled?, onrejected?): Promise<...>;
39
- catch(onrejected?): Promise<...>;
40
- kill(signal?: NodeJS.Signals | number): boolean;
41
- }
42
- ```
43
-
44
- | Member | Type | Description |
45
- |--------|------|-------------|
46
- | `pid` | `number \| undefined` | 프로세스 ID |
47
- | `then` | method | PromiseLike 구현 |
48
- | `catch` | method | PromiseLike 구현 |
49
- | `kill` | method | 프로세스에 시그널 전송. 성공 여부 반환 |
50
-
51
- ---
52
-
53
- ## `spawn`
54
-
55
- 비동기 자식 프로세스를 실행한다. `SpawnProcess`를 반환하므로 `await`로 결과를 기다리거나 `kill()`로 종료할 수 있다.
56
-
57
- 기본적으로 `exitCode !== 0`이면 reject된다. `options.reject: false`를 지정하면 항상 resolve된다.
58
-
59
- ```typescript
60
- export function spawn(
61
- cmd: string,
62
- args: string[],
63
- options?: SpawnOptions & { reject?: boolean },
64
- ): SpawnProcess
65
- ```
66
-
67
- | Parameter | Type | Description |
68
- |-----------|------|-------------|
69
- | `cmd` | `string` | 실행할 명령어 |
70
- | `args` | `string[]` | 명령어 인수 |
71
- | `options` | `SpawnOptions & { reject?: boolean }` | Node.js `child_process.spawn` 옵션 + `reject` 플래그 |
72
- | `options.reject` | `boolean` | false이면 exitCode != 0이어도 resolve. 기본값 true |
73
-
74
- ```typescript
75
- // 기본 사용
76
- const result = await cpx.spawn("git", ["status"], { cwd: "/project" });
77
-
78
- // 종료 가능한 프로세스
79
- const proc = cpx.spawn("long-running-cmd", []);
80
- proc.kill();
81
-
82
- // 출력 직접 표시, 오류 무시
83
- await cpx.spawn("make", ["build"], { stdio: "inherit", reject: false });
84
- ```
85
-
86
- ---
87
-
88
- ## `spawnSync`
89
-
90
- 동기 자식 프로세스를 실행한다. `SpawnResult`를 직접 반환한다.
91
-
92
- 기본적으로 `exitCode !== 0`이면 throw된다. `options.reject: false`를 지정하면 항상 반환된다.
93
-
94
- ```typescript
95
- export function spawnSync(
96
- cmd: string,
97
- args: string[],
98
- options?: SpawnSyncOptions & { reject?: boolean },
99
- ): SpawnResult
100
- ```
101
-
102
- | Parameter | Type | Description |
103
- |-----------|------|-------------|
104
- | `cmd` | `string` | 실행할 명령어 |
105
- | `args` | `string[]` | 명령어 인수 |
106
- | `options` | `SpawnSyncOptions & { reject?: boolean }` | Node.js `child_process.spawnSync` 옵션 + `reject` 플래그 |
107
- | `options.reject` | `boolean` | false이면 exitCode != 0이어도 반환. 기본값 true |
108
-
109
- ---
110
-
111
- ## `getSystemEncoding`
112
-
113
- 시스템 인코딩을 감지한다. 결과는 캐시된다.
114
-
115
- - Windows: `chcp` 명령으로 코드 페이지 번호를 읽어 인코딩 이름으로 변환
116
- - Linux/macOS: `LANG` 또는 `LC_ALL` 환경변수에서 추출
117
- - 감지 실패 시 `"utf-8"` 반환
118
-
119
- ```typescript
120
- export function getSystemEncoding(): string
121
- ```
122
-
123
- ---
124
-
125
- ## `codePageToEncoding`
126
-
127
- Windows 코드 페이지 번호를 인코딩 이름으로 변환한다.
128
-
129
- ```typescript
130
- export function codePageToEncoding(codePage: number): string
131
- ```
132
-
133
- | Parameter | Type | Description |
134
- |-----------|------|-------------|
135
- | `codePage` | `number` | Windows 코드 페이지 번호 (예: 65001, 949) |
136
-
137
- **반환**: 인코딩 이름 (예: `"utf-8"`, `"euc-kr"`). 알 수 없는 코드 페이지는 `"utf-8"` 반환.
138
-
139
- 지원하는 코드 페이지:
140
-
141
- | Code Page | Encoding |
142
- |-----------|----------|
143
- | 65001 | utf-8 |
144
- | 949 | euc-kr |
145
- | 932 | shift-jis |
146
- | 936 | gbk |
147
- | 950 | big5 |
148
- | 1252 | windows-1252 |
149
- | 1251 | windows-1251 |
150
- | 1250 | windows-1250 |
151
- | 874 | windows-874 |
152
-
153
- ---
154
-
155
- ## `resetEncodingCache`
156
-
157
- `getSystemEncoding()`이 캐시한 인코딩 값을 초기화한다. 다음 호출 시 재감지한다.
158
-
159
- ```typescript
160
- export function resetEncodingCache(): void
161
- ```
162
-
163
- ---
164
-
165
- ## `decodeBytes`
166
-
167
- `Uint8Array`를 시스템 인코딩으로 문자열로 디코딩한다. UTF-8로 먼저 시도하고 실패 시 시스템 인코딩을 사용한다.
168
-
169
- ```typescript
170
- export function decodeBytes(raw: Uint8Array, systemEncoding?: string): string
171
- ```
172
-
173
- | Parameter | Type | Description |
174
- |-----------|------|-------------|
175
- | `raw` | `Uint8Array` | 디코딩할 바이트 배열 |
176
- | `systemEncoding` | `string` | 사용할 인코딩. 생략 시 `getSystemEncoding()` 결과 사용 |
177
-
178
- ---
179
-
180
- ## `resolveStdioPipe`
181
-
182
- Node.js `stdio` 옵션에서 stdout/stderr가 pipe인지 여부를 추출한다.
183
-
184
- ```typescript
185
- export function resolveStdioPipe(
186
- stdio: SpawnOptions["stdio"],
187
- ): { stdout: boolean; stderr: boolean }
188
- ```
189
-
190
- | Parameter | Type | Description |
191
- |-----------|------|-------------|
192
- | `stdio` | `SpawnOptions["stdio"]` | Node.js spawn의 stdio 옵션 |
193
-
194
- **반환**: `{ stdout: boolean, stderr: boolean }`. `stdio`가 `"pipe"` 또는 `null`/`undefined`이면 둘 다 `true`.