@crewx/cli 0.8.7-rc.2 → 0.8.7-rc.21

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/dist/builtin.js CHANGED
@@ -52,6 +52,7 @@ const BUILTIN_MAP = {
52
52
  cron: () => Promise.resolve().then(() => __importStar(require('@crewx/cron/cli'))),
53
53
  workflow: () => Promise.resolve().then(() => __importStar(require('@crewx/workflow/cli'))),
54
54
  skill: () => Promise.resolve().then(() => __importStar(require('@crewx/skill/cli'))),
55
+ wi: () => Promise.resolve().then(() => __importStar(require('@crewx/wi/cli'))),
55
56
  };
56
57
  exports.BUILTIN_COMMANDS = new Set(Object.keys(BUILTIN_MAP));
57
58
  // Load skill-tracer for observability (graceful degradation if unavailable)
@@ -13,6 +13,23 @@ const fs_1 = require("fs");
13
13
  const path_1 = require("path");
14
14
  const repository_1 = require("@crewx/sdk/repository");
15
15
  const install_1 = require("./hook/install");
16
+ const CREWX_MARKER = '# CrewX runtime';
17
+ const CREWX_GITIGNORE = `# CrewX runtime
18
+ .crewx/
19
+
20
+ # Memory runtime state (regenerable from entries/)
21
+ memory/*/.dirty-summary
22
+ memory/*/graph.json
23
+ memory/*/summary.md
24
+
25
+ # Skill runtime
26
+ skills/*/.data/
27
+ skills/*/sessions/
28
+ skills/*/logs/
29
+ skills/*/.crewx/
30
+
31
+ # OS
32
+ .DS_Store`.trim();
16
33
  const DEFAULT_AGENTS = [
17
34
  {
18
35
  id: 'planner',
@@ -66,6 +83,202 @@ const DEFAULT_AGENTS = [
66
83
  },
67
84
  },
68
85
  ];
86
+ const GOAL_TEMPLATE = `---
87
+ type: goal
88
+ description: CrewX Goal — OKR
89
+ notation:
90
+ weight: "(w:N) — KR weight, default 1 if omitted"
91
+ auto: "N% auto — L1 progress auto-calculated as weighted average of children"
92
+ ---
93
+
94
+ # 목표 제목
95
+
96
+ ## Period
97
+ - Start: YYYY-MM-DD
98
+ - End: YYYY-MM-DD
99
+ - Status: active
100
+
101
+ ## Objective
102
+ 이 목표는...
103
+
104
+ ## Key Results
105
+ - [ ] KR1:
106
+ - [ ] KR2:
107
+ - [ ] KR3:
108
+
109
+ ## Notes
110
+
111
+ ## Reflection
112
+ `;
113
+ const DAILY_TEMPLATE = `# YYYY-MM-DD (Day)
114
+
115
+ ## Top 3
116
+ 1.
117
+ 2.
118
+ 3.
119
+
120
+ ## Brain Dump
121
+
122
+ ## Schedule
123
+
124
+ ## Notes
125
+
126
+ ## Reflection
127
+ `;
128
+ const WI_TEMPLATE = `---
129
+ wi_id: WI-{YYYYMMDD}-{SEQ}
130
+ title: ""
131
+ date: ""
132
+ author: ""
133
+ status: draft # draft | approved | in-progress | done | cancelled
134
+ priority: normal # critical | high | normal | low
135
+
136
+ # Assignment
137
+ assignee: "" # Agent assigned to this work
138
+ reviewer: "" # Agent to review
139
+
140
+ # Git
141
+ base_branch: main
142
+ target_branch: develop
143
+ worktree: false # true = work in isolated worktree
144
+
145
+ # Design doc cross-link
146
+ spec_id: "" # Design doc API ID (e.g. MSG.LIST)
147
+ design_doc: ""
148
+ design_section: ""
149
+ screens: [] # Affected screen IDs (e.g. THDUI002)
150
+
151
+ # Dependencies
152
+ depends_on: [] # WI IDs that must complete before this starts
153
+ blocks: [] # WI IDs blocked by this WI
154
+
155
+ # Impact
156
+ risk_level: low # low | medium | high | critical
157
+ api_changed: false # if true, contract_type + consumers required
158
+ contract_type: none # none | additive | breaking | deprecation
159
+ schema_changed: false # if true, check migration needs
160
+
161
+ # Consumers (required when api_changed: true)
162
+ consumers:
163
+ # - screen: THDUI002
164
+ # file: src/ui/pages/threads/ThreadDetailPage.tsx
165
+ # store: useThreadDetailStore
166
+ # component: MessageBubble
167
+
168
+ # Estimated scope (atomicity: ≤ $0.30, 1-3 files)
169
+ estimated_files: 0
170
+ estimated_cost: "$0.00"
171
+ ---
172
+
173
+ # {title}
174
+
175
+ ## Background (Why)
176
+
177
+ > Why this work is needed. 1-3 sentences.
178
+
179
+ ## Goal (What)
180
+
181
+ > What changes when this is complete. Feature perspective.
182
+
183
+ ## Scope
184
+
185
+ ### Files to modify
186
+
187
+ | File | Description |
188
+ |------|-------------|
189
+ | \`path/to/file.ts\` | description |
190
+
191
+ **Out of scope (do not touch)**
192
+
193
+ - list items
194
+
195
+ ## Impact Analysis
196
+
197
+ ### Design doc cross-link
198
+
199
+ > Summary of the relevant design doc section.
200
+
201
+ \`\`\`bash
202
+ npx doc section {design_doc} "{spec_id}"
203
+ \`\`\`
204
+
205
+ | Item | Value |
206
+ |------|-------|
207
+ | API ID | \`{spec_id}\` |
208
+ | Screen ID | \`{screens}\` |
209
+ | Section | \`{design_section}\` |
210
+
211
+ ### API / Type changes
212
+
213
+ > Skip this section if \`api_changed: false\`.
214
+
215
+ | Changed item | contract_type | Consumers (screen / file / store) |
216
+ |-------------|--------------|-----------------------------------|
217
+ | (none) | - | - |
218
+
219
+ ### Consumer impact checklist
220
+
221
+ > Required when \`api_changed: true\`. Empty = cannot approve.
222
+
223
+ - [ ] Affected screen IDs identified (\`screens\` field)
224
+ - [ ] Affected frontend components identified (\`consumers.component\`)
225
+ - [ ] Affected stores identified (\`consumers.store\`)
226
+ - [ ] If \`contract_type: breaking\`, issue separate consumer WI (add to \`blocks\`)
227
+ - [ ] DB schema change migration: (none / Phase N needed)
228
+
229
+ ### Side-effect risk areas
230
+
231
+ > Areas that broke in similar past work. "None" if none.
232
+
233
+ ### risk_level criteria
234
+
235
+ | Level | Condition |
236
+ |-------|-----------|
237
+ | \`low\` | Single file, no API change, existing tests sufficient |
238
+ | \`medium\` | 2-3 files, API change with ≤ 1 consumer |
239
+ | \`high\` | API change + 2+ consumers, or store refactoring |
240
+ | \`critical\` | DB schema change, or core SDK interface change |
241
+
242
+ > \`high\` or above: consult lead before implementation.
243
+
244
+ ---
245
+
246
+ ## Implementation Guide (How)
247
+
248
+ > Concrete instructions an agent can follow without judgment calls.
249
+ > Include code examples, type definitions, caveats.
250
+
251
+ \`\`\`typescript
252
+ // Example code (if applicable)
253
+ \`\`\`
254
+
255
+ ## Acceptance Criteria (AC)
256
+
257
+ > All must pass to mark "done". If any fails, STOP and report.
258
+
259
+ - [ ] \`npx tsc --noEmit\` passes
260
+ - [ ] \`npx vitest run src/server/\` passes (backend work)
261
+ - [ ] \`npx vitest run src/ui/\` passes (frontend work)
262
+ - [ ] (add feature-specific AC)
263
+
264
+ ## Completion Report Format
265
+
266
+ \`\`\`
267
+ ## Completion Report
268
+
269
+ ### Modified files
270
+ - path/to/file.ts (+N/-M)
271
+
272
+ ### tsc result
273
+ Pass / Fail
274
+
275
+ ### Test result
276
+ N tests passed
277
+
278
+ ### Remaining items
279
+ None / (list if any)
280
+ \`\`\`
281
+ `;
69
282
  function indentBlock(text, spaces) {
70
283
  const prefix = ' '.repeat(spaces);
71
284
  return text
@@ -138,14 +351,6 @@ async function handleInit(opts) {
138
351
  catch (e) {
139
352
  throw new Error(`YAML_CREATE_FAILED: ${e.message}`);
140
353
  }
141
- for (const dir of ['.crewx/logs', '.claude/commands']) {
142
- try {
143
- (0, fs_1.mkdirSync)((0, path_1.join)(target, dir), { recursive: true });
144
- }
145
- catch (e) {
146
- errors.push(`MKDIR_FAILED:${dir}:${e.message}`);
147
- }
148
- }
149
354
  if (!skipHook) {
150
355
  try {
151
356
  await (0, install_1.handleHookInstall)({ projectRoot: target, yes: true });
@@ -156,6 +361,28 @@ async function handleInit(opts) {
156
361
  }
157
362
  }
158
363
  }
364
+ // Always create docs dirs and templates, regardless of whether yaml was skipped
365
+ for (const dir of ['.crewx/logs', '.claude/commands', 'docs/goal', 'docs/daily', 'docs/wi']) {
366
+ try {
367
+ (0, fs_1.mkdirSync)((0, path_1.join)(target, dir), { recursive: true });
368
+ }
369
+ catch (e) {
370
+ errors.push(`MKDIR_FAILED:${dir}:${e.message}`);
371
+ }
372
+ }
373
+ const docTemplates = [
374
+ { dir: 'docs/goal', file: 'GOAL-TEMPLATE.md', content: GOAL_TEMPLATE },
375
+ { dir: 'docs/daily', file: 'DAILY-TEMPLATE.md', content: DAILY_TEMPLATE },
376
+ { dir: 'docs/wi', file: 'WI-TEMPLATE.md', content: WI_TEMPLATE },
377
+ ];
378
+ for (const t of docTemplates) {
379
+ const fullPath = (0, path_1.join)(target, t.dir, t.file);
380
+ if (force || !(0, fs_1.existsSync)(fullPath)) {
381
+ const action = (0, fs_1.existsSync)(fullPath) ? 'updated' : 'created';
382
+ (0, fs_1.writeFileSync)(fullPath, t.content, 'utf-8');
383
+ console.log(`✅ ${t.dir}/ ${action} (${t.file})`);
384
+ }
385
+ }
159
386
  // Always register workspace in ~/.crewx/crewx.db (best-effort, idempotent)
160
387
  let workspaceId;
161
388
  let slug;
@@ -167,5 +394,21 @@ async function handleInit(opts) {
167
394
  catch (e) {
168
395
  errors.push(`WORKSPACE_REGISTER_FAILED: ${e.message}`);
169
396
  }
397
+ const gitignorePath = (0, path_1.join)(target, '.gitignore');
398
+ if (!(0, fs_1.existsSync)(gitignorePath)) {
399
+ (0, fs_1.writeFileSync)(gitignorePath, CREWX_GITIGNORE + '\n', 'utf-8');
400
+ console.log('✅ .gitignore updated with CrewX entries');
401
+ }
402
+ else {
403
+ const existing = (0, fs_1.readFileSync)(gitignorePath, 'utf-8');
404
+ if (!existing.includes(CREWX_MARKER)) {
405
+ const separator = existing.endsWith('\n') ? '\n' : '\n\n';
406
+ (0, fs_1.appendFileSync)(gitignorePath, separator + CREWX_GITIGNORE + '\n', 'utf-8');
407
+ console.log('✅ .gitignore updated with CrewX entries');
408
+ }
409
+ else {
410
+ console.log('ℹ .gitignore already contains CrewX entries');
411
+ }
412
+ }
170
413
  return { yamlCreated, hookInstalled, errors, skippedReason, workspaceId, slug };
171
414
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/cli",
3
- "version": "0.8.7-rc.2",
3
+ "version": "0.8.7-rc.21",
4
4
  "license": "UNLICENSED",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"
@@ -23,15 +23,16 @@
23
23
  "dependencies": {
24
24
  "@crewx/adapter-slack": "0.1.4",
25
25
  "better-sqlite3": "*",
26
- "@crewx/memory": "0.1.12",
27
- "@crewx/sdk": "0.8.7-rc.2",
26
+ "@crewx/sdk": "0.8.7-rc.21",
27
+ "@crewx/memory": "0.1.19",
28
28
  "@crewx/doc": "0.1.8",
29
- "@crewx/cron": "0.1.8",
30
- "@crewx/wbs": "0.1.9",
31
29
  "@crewx/search": "0.1.9",
32
- "@crewx/skill": "0.1.10",
30
+ "@crewx/wbs": "0.1.9",
33
31
  "@crewx/workflow": "0.3.18",
34
- "@crewx/shared": "0.0.5"
32
+ "@crewx/skill": "0.1.17",
33
+ "@crewx/wi": "0.1.7",
34
+ "@crewx/shared": "0.0.5",
35
+ "@crewx/cron": "0.1.8"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@types/better-sqlite3": "*",