team-toon-tack 1.0.5 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "team-toon-tack",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Linear task sync & management CLI with TOON format",
5
5
  "type": "module",
6
6
  "bin": {
package/scripts/init.ts CHANGED
@@ -277,7 +277,14 @@ async function init() {
277
277
  complete: 'Done',
278
278
  need_review: 'In Review'
279
279
  },
280
- priority_order: ['urgent', 'high', 'medium', 'low', 'none']
280
+ priority_order: ['urgent', 'high', 'medium', 'low', 'none'],
281
+ current_cycle: currentCycle ? {
282
+ id: currentCycle.id,
283
+ name: currentCycle.name || 'Cycle',
284
+ start_date: currentCycle.startsAt?.toISOString().split('T')[0] || '',
285
+ end_date: currentCycle.endsAt?.toISOString().split('T')[0] || ''
286
+ } : undefined,
287
+ cycle_history: []
281
288
  };
282
289
 
283
290
  // Find current user key
@@ -293,17 +300,32 @@ async function init() {
293
300
  // Write config files
294
301
  console.log('\nšŸ“ Writing configuration files...');
295
302
 
303
+ // Ensure directory exists
304
+ await fs.mkdir(paths.baseDir, { recursive: true });
305
+
296
306
  // Merge with existing config if exists
297
307
  if (configExists && !options.force) {
298
308
  try {
299
309
  const existingContent = await fs.readFile(paths.configPath, 'utf-8');
300
310
  const existingConfig = decode(existingContent) as unknown as Config;
301
311
 
302
- // Merge: new data takes precedence but preserve existing custom fields
312
+ // Merge: preserve existing custom fields
303
313
  config.status_transitions = {
304
314
  ...existingConfig.status_transitions,
305
315
  ...config.status_transitions
306
316
  };
317
+ // Preserve cycle history
318
+ if (existingConfig.cycle_history) {
319
+ config.cycle_history = existingConfig.cycle_history;
320
+ }
321
+ // Preserve current_cycle if not fetched fresh
322
+ if (!currentCycle && existingConfig.current_cycle) {
323
+ config.current_cycle = existingConfig.current_cycle;
324
+ }
325
+ // Preserve priority_order if exists
326
+ if (existingConfig.priority_order) {
327
+ config.priority_order = existingConfig.priority_order;
328
+ }
307
329
  } catch {
308
330
  // Ignore merge errors
309
331
  }
package/scripts/sync.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { getLinearClient, loadConfig, loadLocalConfig, loadCycleData, saveCycleData, getTeamId, getPrioritySortIndex, CycleData, Task, Attachment, Comment } from './utils';
1
+ import { getLinearClient, loadConfig, loadLocalConfig, loadCycleData, saveCycleData, saveConfig, getTeamId, getPrioritySortIndex, CycleData, Task, Attachment, Comment, CycleInfo } from './utils';
2
2
 
3
3
  async function sync() {
4
4
  const args = process.argv.slice(2);
@@ -49,12 +49,41 @@ Examples:
49
49
  const activeCycle = cycles.nodes[0];
50
50
  const cycleId = activeCycle.id;
51
51
  const cycleName = activeCycle.name ?? 'Cycle';
52
+ const newCycleInfo: CycleInfo = {
53
+ id: cycleId,
54
+ name: cycleName,
55
+ start_date: activeCycle.startsAt?.toISOString().split('T')[0] ?? '',
56
+ end_date: activeCycle.endsAt?.toISOString().split('T')[0] ?? ''
57
+ };
52
58
 
53
- // Check if cycle changed by comparing with existing cycle.toon
59
+ // Check if cycle changed and update config with history
54
60
  const existingData = await loadCycleData();
55
- if (existingData && existingData.cycleId !== cycleId) {
56
- console.log(`Cycle changed: ${existingData.cycleName} → ${cycleName}`);
61
+ const oldCycleId = config.current_cycle?.id ?? existingData?.cycleId;
62
+
63
+ if (oldCycleId && oldCycleId !== cycleId) {
64
+ const oldCycleName = config.current_cycle?.name ?? existingData?.cycleName ?? 'Unknown';
65
+ console.log(`Cycle changed: ${oldCycleName} → ${cycleName}`);
66
+
67
+ // Move old cycle to history
68
+ if (config.current_cycle) {
69
+ config.cycle_history = config.cycle_history ?? [];
70
+ config.cycle_history.unshift(config.current_cycle);
71
+ // Keep only last 10 cycles
72
+ if (config.cycle_history.length > 10) {
73
+ config.cycle_history = config.cycle_history.slice(0, 10);
74
+ }
75
+ }
76
+
77
+ // Update current cycle
78
+ config.current_cycle = newCycleInfo;
79
+ await saveConfig(config);
80
+ console.log('Config updated with new cycle (old cycle saved to history).');
57
81
  } else {
82
+ // Update current cycle info even if ID unchanged (dates might change)
83
+ if (!config.current_cycle || config.current_cycle.id !== cycleId) {
84
+ config.current_cycle = newCycleInfo;
85
+ await saveConfig(config);
86
+ }
58
87
  console.log(`Current cycle: ${cycleName}`);
59
88
  }
60
89
 
package/scripts/utils.ts CHANGED
@@ -52,6 +52,13 @@ export interface LabelConfig {
52
52
  color?: string;
53
53
  }
54
54
 
55
+ export interface CycleInfo {
56
+ id: string;
57
+ name: string;
58
+ start_date: string;
59
+ end_date: string;
60
+ }
61
+
55
62
  export interface Config {
56
63
  teams: Record<string, TeamConfig>;
57
64
  users: Record<string, UserConfig>;
@@ -60,6 +67,8 @@ export interface Config {
60
67
  statuses?: Record<string, { name: string; type: string }>;
61
68
  status_transitions?: Record<string, string>;
62
69
  priority_order?: string[]; // e.g., ['urgent', 'high', 'medium', 'low', 'none']
70
+ current_cycle?: CycleInfo;
71
+ cycle_history?: CycleInfo[];
63
72
  }
64
73
 
65
74
  // Linear priority value to name mapping (fixed by Linear API)