team-toon-tack 1.0.7 → 1.0.9
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 +1 -1
- package/scripts/done-job.ts +3 -2
- package/scripts/init.ts +11 -8
- package/scripts/sync.ts +5 -9
- package/scripts/utils.ts +1 -0
- package/scripts/work-on.ts +1 -1
package/package.json
CHANGED
package/scripts/done-job.ts
CHANGED
|
@@ -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
|
@@ -177,12 +177,8 @@ async function init() {
|
|
|
177
177
|
});
|
|
178
178
|
const states = statesData.nodes;
|
|
179
179
|
|
|
180
|
-
// Fetch current cycle
|
|
181
|
-
const
|
|
182
|
-
filter: { isActive: { eq: true } },
|
|
183
|
-
first: 1
|
|
184
|
-
});
|
|
185
|
-
const currentCycle = cyclesData.nodes[0];
|
|
180
|
+
// Fetch current cycle using activeCycle (direct and accurate)
|
|
181
|
+
const currentCycle = await selectedTeam.activeCycle;
|
|
186
182
|
|
|
187
183
|
// Select current user
|
|
188
184
|
let currentUser = users[0];
|
|
@@ -280,7 +276,7 @@ async function init() {
|
|
|
280
276
|
priority_order: ['urgent', 'high', 'medium', 'low', 'none'],
|
|
281
277
|
current_cycle: currentCycle ? {
|
|
282
278
|
id: currentCycle.id,
|
|
283
|
-
name: currentCycle.name ||
|
|
279
|
+
name: currentCycle.name || `Cycle #${currentCycle.number}`,
|
|
284
280
|
start_date: currentCycle.startsAt?.toISOString().split('T')[0] || '',
|
|
285
281
|
end_date: currentCycle.endsAt?.toISOString().split('T')[0] || ''
|
|
286
282
|
} : undefined,
|
|
@@ -292,8 +288,14 @@ async function init() {
|
|
|
292
288
|
([_, u]) => u.id === currentUser.id
|
|
293
289
|
)?.[0] || 'user';
|
|
294
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
|
+
|
|
295
296
|
const localConfig: LocalConfig = {
|
|
296
297
|
current_user: currentUserKey,
|
|
298
|
+
team: selectedTeamKey,
|
|
297
299
|
label: defaultLabel
|
|
298
300
|
};
|
|
299
301
|
|
|
@@ -342,6 +344,7 @@ async function init() {
|
|
|
342
344
|
|
|
343
345
|
// Preserve existing values
|
|
344
346
|
if (existingLocal.current_user) localConfig.current_user = existingLocal.current_user;
|
|
347
|
+
if (existingLocal.team) localConfig.team = existingLocal.team;
|
|
345
348
|
if (existingLocal.label) localConfig.label = existingLocal.label;
|
|
346
349
|
if (existingLocal.exclude_assignees) localConfig.exclude_assignees = existingLocal.exclude_assignees;
|
|
347
350
|
} catch {
|
|
@@ -359,7 +362,7 @@ async function init() {
|
|
|
359
362
|
console.log(` User: ${currentUser.displayName || currentUser.name} (${currentUser.email})`);
|
|
360
363
|
console.log(` Label: ${defaultLabel}`);
|
|
361
364
|
if (currentCycle) {
|
|
362
|
-
console.log(` Cycle: ${currentCycle.name}`);
|
|
365
|
+
console.log(` Cycle: ${currentCycle.name || `Cycle #${currentCycle.number}`}`);
|
|
363
366
|
}
|
|
364
367
|
|
|
365
368
|
console.log('\nNext steps:');
|
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(
|
|
@@ -33,22 +33,18 @@ Examples:
|
|
|
33
33
|
.filter(Boolean)
|
|
34
34
|
);
|
|
35
35
|
|
|
36
|
-
// Phase 1: Fetch
|
|
36
|
+
// Phase 1: Fetch active cycle directly from team
|
|
37
37
|
console.log('Fetching latest cycle...');
|
|
38
38
|
const team = await client.team(teamId);
|
|
39
|
-
const
|
|
40
|
-
filter: { isActive: { eq: true } },
|
|
41
|
-
first: 1
|
|
42
|
-
});
|
|
39
|
+
const activeCycle = await team.activeCycle;
|
|
43
40
|
|
|
44
|
-
if (
|
|
41
|
+
if (!activeCycle) {
|
|
45
42
|
console.error('No active cycle found.');
|
|
46
43
|
process.exit(1);
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
const activeCycle = cycles.nodes[0];
|
|
50
46
|
const cycleId = activeCycle.id;
|
|
51
|
-
const cycleName = activeCycle.name ??
|
|
47
|
+
const cycleName = activeCycle.name ?? `Cycle #${activeCycle.number}`;
|
|
52
48
|
const newCycleInfo: CycleInfo = {
|
|
53
49
|
id: cycleId,
|
|
54
50
|
name: cycleName,
|
package/scripts/utils.ts
CHANGED
package/scripts/work-on.ts
CHANGED
|
@@ -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
|
|