team-toon-tack 1.0.8 → 1.0.10

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.8",
3
+ "version": "1.0.10",
4
4
  "description": "Linear task sync & management CLI with TOON format",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  import prompts from 'prompts';
2
2
  import { execSync } from 'node:child_process';
3
- import { getLinearClient, loadConfig, loadCycleData, saveCycleData, getTeamId, getDefaultTeamKey } from './utils';
3
+ import { getLinearClient, loadConfig, loadLocalConfig, loadCycleData, saveCycleData, getTeamId, getDefaultTeamKey } from './utils';
4
4
 
5
5
  interface CommitInfo {
6
6
  shortHash: string;
@@ -86,6 +86,7 @@ Examples:
86
86
  let issueId = argIssueId;
87
87
 
88
88
  const config = await loadConfig();
89
+ const localConfig = await loadLocalConfig();
89
90
  const data = await loadCycleData();
90
91
 
91
92
  if (!data) {
@@ -163,7 +164,7 @@ Examples:
163
164
  try {
164
165
  const client = getLinearClient();
165
166
  const workflowStates = await client.workflowStates({
166
- filter: { team: { id: { eq: getTeamId(config) } } }
167
+ filter: { team: { id: { eq: getTeamId(config, localConfig.team) } } }
167
168
  });
168
169
  const doneState = workflowStates.nodes.find(s => s.name === 'Done');
169
170
 
package/scripts/init.ts CHANGED
@@ -288,8 +288,14 @@ async function init() {
288
288
  ([_, u]) => u.id === currentUser.id
289
289
  )?.[0] || 'user';
290
290
 
291
+ // Find selected team key
292
+ const selectedTeamKey = Object.entries(teamsConfig).find(
293
+ ([_, t]) => t.id === selectedTeam.id
294
+ )?.[0] || Object.keys(teamsConfig)[0];
295
+
291
296
  const localConfig: LocalConfig = {
292
297
  current_user: currentUserKey,
298
+ team: selectedTeamKey,
293
299
  label: defaultLabel
294
300
  };
295
301
 
@@ -338,6 +344,7 @@ async function init() {
338
344
 
339
345
  // Preserve existing values
340
346
  if (existingLocal.current_user) localConfig.current_user = existingLocal.current_user;
347
+ if (existingLocal.team) localConfig.team = existingLocal.team;
341
348
  if (existingLocal.label) localConfig.label = existingLocal.label;
342
349
  if (existingLocal.exclude_assignees) localConfig.exclude_assignees = existingLocal.exclude_assignees;
343
350
  } catch {
package/scripts/sync.ts CHANGED
@@ -24,7 +24,7 @@ Examples:
24
24
  const config = await loadConfig();
25
25
  const localConfig = await loadLocalConfig();
26
26
  const client = getLinearClient();
27
- const teamId = getTeamId(config);
27
+ const teamId = getTeamId(config, localConfig.team);
28
28
 
29
29
  // Build excluded emails from local config
30
30
  const excludedEmails = new Set(
@@ -60,9 +60,11 @@ Examples:
60
60
  const oldCycleName = config.current_cycle?.name ?? existingData?.cycleName ?? 'Unknown';
61
61
  console.log(`Cycle changed: ${oldCycleName} → ${cycleName}`);
62
62
 
63
- // Move old cycle to history
63
+ // Move old cycle to history (avoid duplicates)
64
64
  if (config.current_cycle) {
65
65
  config.cycle_history = config.cycle_history ?? [];
66
+ // Remove if already exists in history
67
+ config.cycle_history = config.cycle_history.filter(c => c.id !== config.current_cycle!.id);
66
68
  config.cycle_history.unshift(config.current_cycle);
67
69
  // Keep only last 10 cycles
68
70
  if (config.cycle_history.length > 10) {
package/scripts/utils.ts CHANGED
@@ -130,6 +130,7 @@ export interface CycleData {
130
130
 
131
131
  export interface LocalConfig {
132
132
  current_user: string;
133
+ team: string; // team key from config.teams
133
134
  exclude_assignees?: string[];
134
135
  label?: string;
135
136
  }
@@ -120,7 +120,7 @@ Examples:
120
120
  try {
121
121
  const client = getLinearClient();
122
122
  const workflowStates = await client.workflowStates({
123
- filter: { team: { id: { eq: getTeamId(config) } } }
123
+ filter: { team: { id: { eq: getTeamId(config, localConfig.team) } } }
124
124
  });
125
125
  const inProgressState = workflowStates.nodes.find(s => s.name === 'In Progress');
126
126