@qelos/aidev 0.1.16 → 0.1.17

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.
@@ -23,6 +23,9 @@ CLICKUP_IN_REVIEW_STATUS=review
23
23
  # JIRA_IN_REVIEW_STATUS=In Review
24
24
 
25
25
  ASSIGNEE_TAG=
26
+
27
+ # THINKING_TAG: tasks with this tag are analyzed and broken into sub-tasks before execution (optional)
28
+ THINKING_TAG=
26
29
  GIT_REMOTE=origin
27
30
  GITHUB_BASE_BRANCH=main
28
31
  GITHUB_REPO=
package/README.md CHANGED
@@ -19,6 +19,7 @@ ClickUp task → AI implements → git push → "in review"
19
19
  - [How it works](#how-it-works)
20
20
  - [Quick start](#quick-start)
21
21
  - [Commands](#commands)
22
+ - [Concurrency lock](#concurrency-lock)
22
23
  - [Configuration](#configuration)
23
24
  - [AI agents](#ai-agents)
24
25
  - [Dev notes mode](#dev-notes-mode)
@@ -71,6 +72,7 @@ aidev run
71
72
  | `aidev run` | Process all open + pending-with-replies tasks |
72
73
  | `aidev run open` | Only open (non-pending) tasks |
73
74
  | `aidev run pending` | Only pending tasks — check for human replies |
75
+ | `aidev stop` | Stop any running aidev process in the current directory |
74
76
  | `aidev schedule set` | Interactive cron picker for this directory |
75
77
  | `aidev schedule set "<expr>"` | Set a specific cron expression |
76
78
  | `aidev schedule get` | Show the current schedule for this directory |
@@ -98,6 +100,25 @@ aidev schedule set "*/30 * * * *"
98
100
 
99
101
  ---
100
102
 
103
+ ## Concurrency lock
104
+
105
+ `aidev run` writes a PID lock file (`.aidev.lock`) in the current directory when it starts and removes it when it finishes. If a second invocation detects a live process already holding the lock, it logs a warning and exits immediately — preventing two agents from committing to the same branch at the same time.
106
+
107
+ ```
108
+ $ aidev run
109
+ [aidev] aidev is already running in this directory (PID 12345). Use "aidev stop" to terminate it.
110
+ ```
111
+
112
+ Use `aidev stop` to send `SIGTERM` to the running process and clean up the lock file:
113
+
114
+ ```bash
115
+ aidev stop
116
+ ```
117
+
118
+ Stale lock files (left behind by a crash) are detected automatically — the next `aidev run` will overwrite them if the stored PID is no longer alive.
119
+
120
+ ---
121
+
101
122
  ## Configuration
102
123
 
103
124
  Run `aidev init` for an interactive setup, or create `.env.aidev` manually using `.env.aidev.example` as a template.
@@ -142,6 +163,7 @@ CLICKUP_TAG=my-project
142
163
  | `CLICKUP_PENDING_STATUS` | `pending` | Status name for "waiting for reply" |
143
164
  | `CLICKUP_IN_REVIEW_STATUS` | `review` | Status set after implementation |
144
165
  | `ASSIGNEE_TAG` | — | Only process tasks assigned to this user (optional) |
166
+ | `THINKING_TAG` | — | Tasks with this tag are analyzed and broken into sub-tasks before execution (optional) |
145
167
 
146
168
  > **Tip:** `CLICKUP_API_KEY` and `CLICKUP_TEAM_ID` are intentionally omitted from `.env.aidev` if you leave them blank during `aidev init` — they will be read from your shell environment instead.
147
169
 
package/aidev.log CHANGED
@@ -2289,3 +2289,233 @@ hint: or --ff-only on the command line to override the configured default per
2289
2289
  hint: invocation.
2290
2290
  fatal: Need to specify how to reconcile divergent branches.
2291
2291
 
2292
+ 2026-03-08T13:11:40.835Z [info] /Users/davidmeirlevy/dev/qelos/qelos: already up to date
2293
+ 2026-03-08T13:11:40.835Z [info] /Users/davidmeirlevy/dev/qelos/aidev: already up to date
2294
+ 2026-03-08T13:11:40.836Z [info] /Users/davidmeirlevy/dev/ai-words/ai-words: already up to date
2295
+ 2026-03-08T13:11:40.836Z [info] 0 fixed, 3 already up to date
2296
+ 2026-03-08T13:11:57.322Z [info] Scheduled aidev jobs:
2297
+
2298
+ ────────────────────────────────────────────────────────────
2299
+ 2026-03-08T13:17:02.607Z [run] started
2300
+ ────────────────────────────────────────────────────────────
2301
+ 2026-03-08T13:17:02.643Z [info] Fetching tasks (filter: all)...
2302
+ 2026-03-08T13:17:04.171Z [info] Found 0 tagged task(s)
2303
+ 2026-03-08T13:17:04.171Z [success] Done. Processed: 0, Skipped: 0
2304
+
2305
+ ────────────────────────────────────────────────────────────
2306
+ 2026-03-08T13:32:04.325Z [run] started
2307
+ ────────────────────────────────────────────────────────────
2308
+ 2026-03-08T13:32:04.365Z [warn] Screen is locked or display is asleep — AI agents cannot operate
2309
+ 2026-03-08T13:32:04.365Z [info] Fetching tasks (filter: all)...
2310
+ 2026-03-08T13:32:04.616Z [info] Found 0 tagged task(s)
2311
+ 2026-03-08T13:32:04.616Z [success] Done. Processed: 0, Skipped: 0
2312
+ 2026-03-08T13:36:05.416Z [warn] cursor clarification check failed — trying next runner
2313
+ 2026-03-08T13:36:05.419Z [warn] cursor clarification check failed — trying next runner
2314
+ 2026-03-08T13:36:05.419Z [warn] windsurf clarification check failed — trying next runner
2315
+ 2026-03-08T13:36:05.420Z [warn] Clarification check failed for all runners — proceeding without clarification
2316
+ 2026-03-08T13:36:05.420Z [warn] No AI runner available — skipping clarification check
2317
+ 2026-03-08T13:36:05.632Z [error] Cannot create branch "task123/fix-bug": expected to be on "main" but currently on "some-other-branch"
2318
+ 2026-03-08T13:36:05.797Z [error] Refusing to commit: expected branch "task123/fix-bug" but currently on "wrong-branch"
2319
+ 2026-03-08T13:36:05.842Z [error] Refusing to commit directly to protected branch "main"
2320
+ 2026-03-08T13:36:05.983Z [error] Refusing to push directly to protected branch "main"
2321
+ 2026-03-08T13:36:06.081Z [error] Refusing to push: current branch "task123/fix-bug" does not match target branch "task456/other-task"
2322
+ 2026-03-08T13:36:07.607Z [error] git pull failed: From /var/folders/88/xzz9sxx15s13cmqq5_1k0t480000gn/T/aidev-bare-ZU1TDW
2323
+ * branch main -> FETCH_HEAD
2324
+ hint: You have divergent branches and need to specify how to reconcile them.
2325
+ hint: You can do so by running one of the following commands sometime before
2326
+ hint: your next pull:
2327
+ hint:
2328
+ hint: git config pull.rebase false # merge
2329
+ hint: git config pull.rebase true # rebase
2330
+ hint: git config pull.ff only # fast-forward only
2331
+ hint:
2332
+ hint: You can replace "git config" with "git config --global" to set a default
2333
+ hint: preference for all repositories. You can also pass --rebase, --no-rebase,
2334
+ hint: or --ff-only on the command line to override the configured default per
2335
+ hint: invocation.
2336
+ fatal: Need to specify how to reconcile divergent branches.
2337
+
2338
+ 2026-03-08T13:36:10.394Z [warn] cursor clarification check failed — trying next runner
2339
+ 2026-03-08T13:36:10.396Z [warn] cursor clarification check failed — trying next runner
2340
+ 2026-03-08T13:36:10.396Z [warn] windsurf clarification check failed — trying next runner
2341
+ 2026-03-08T13:36:10.396Z [warn] Clarification check failed for all runners — proceeding without clarification
2342
+ 2026-03-08T13:36:10.396Z [warn] No AI runner available — skipping clarification check
2343
+ 2026-03-08T13:36:10.593Z [error] Cannot create branch "task123/fix-bug": expected to be on "main" but currently on "some-other-branch"
2344
+ 2026-03-08T13:36:10.758Z [error] Refusing to commit: expected branch "task123/fix-bug" but currently on "wrong-branch"
2345
+ 2026-03-08T13:36:10.803Z [error] Refusing to commit directly to protected branch "main"
2346
+ 2026-03-08T13:36:10.942Z [error] Refusing to push directly to protected branch "main"
2347
+ 2026-03-08T13:36:11.031Z [error] Refusing to push: current branch "task123/fix-bug" does not match target branch "task456/other-task"
2348
+ 2026-03-08T13:36:12.542Z [error] git pull failed: From /var/folders/88/xzz9sxx15s13cmqq5_1k0t480000gn/T/aidev-bare-fXsS50
2349
+ * branch main -> FETCH_HEAD
2350
+ hint: You have divergent branches and need to specify how to reconcile them.
2351
+ hint: You can do so by running one of the following commands sometime before
2352
+ hint: your next pull:
2353
+ hint:
2354
+ hint: git config pull.rebase false # merge
2355
+ hint: git config pull.rebase true # rebase
2356
+ hint: git config pull.ff only # fast-forward only
2357
+ hint:
2358
+ hint: You can replace "git config" with "git config --global" to set a default
2359
+ hint: preference for all repositories. You can also pass --rebase, --no-rebase,
2360
+ hint: or --ff-only on the command line to override the configured default per
2361
+ hint: invocation.
2362
+ fatal: Need to specify how to reconcile divergent branches.
2363
+
2364
+ 2026-03-08T13:36:16.109Z [warn] cursor clarification check failed — trying next runner
2365
+ 2026-03-08T13:36:16.110Z [warn] cursor clarification check failed — trying next runner
2366
+ 2026-03-08T13:36:16.110Z [warn] windsurf clarification check failed — trying next runner
2367
+ 2026-03-08T13:36:16.110Z [warn] Clarification check failed for all runners — proceeding without clarification
2368
+ 2026-03-08T13:36:16.110Z [warn] No AI runner available — skipping clarification check
2369
+ 2026-03-08T13:36:16.305Z [error] Cannot create branch "task123/fix-bug": expected to be on "main" but currently on "some-other-branch"
2370
+ 2026-03-08T13:36:16.470Z [error] Refusing to commit: expected branch "task123/fix-bug" but currently on "wrong-branch"
2371
+ 2026-03-08T13:36:16.516Z [error] Refusing to commit directly to protected branch "main"
2372
+ 2026-03-08T13:36:16.653Z [error] Refusing to push directly to protected branch "main"
2373
+ 2026-03-08T13:36:16.745Z [error] Refusing to push: current branch "task123/fix-bug" does not match target branch "task456/other-task"
2374
+ 2026-03-08T13:36:18.290Z [error] git pull failed: From /var/folders/88/xzz9sxx15s13cmqq5_1k0t480000gn/T/aidev-bare-zQovGU
2375
+ * branch main -> FETCH_HEAD
2376
+ hint: You have divergent branches and need to specify how to reconcile them.
2377
+ hint: You can do so by running one of the following commands sometime before
2378
+ hint: your next pull:
2379
+ hint:
2380
+ hint: git config pull.rebase false # merge
2381
+ hint: git config pull.rebase true # rebase
2382
+ hint: git config pull.ff only # fast-forward only
2383
+ hint:
2384
+ hint: You can replace "git config" with "git config --global" to set a default
2385
+ hint: preference for all repositories. You can also pass --rebase, --no-rebase,
2386
+ hint: or --ff-only on the command line to override the configured default per
2387
+ hint: invocation.
2388
+ fatal: Need to specify how to reconcile divergent branches.
2389
+
2390
+
2391
+ ────────────────────────────────────────────────────────────
2392
+ 2026-03-08T13:47:04.769Z [run] started
2393
+ ────────────────────────────────────────────────────────────
2394
+ 2026-03-08T13:47:04.807Z [info] Fetching tasks (filter: all)...
2395
+ 2026-03-08T13:47:05.116Z [info] Found 0 tagged task(s)
2396
+ 2026-03-08T13:47:05.117Z [success] Done. Processed: 0, Skipped: 0
2397
+
2398
+ ────────────────────────────────────────────────────────────
2399
+ 2026-03-08T14:02:05.282Z [run] started
2400
+ ────────────────────────────────────────────────────────────
2401
+ 2026-03-08T14:02:05.322Z [info] Fetching tasks (filter: all)...
2402
+ 2026-03-08T14:02:05.603Z [info] Found 0 tagged task(s)
2403
+ 2026-03-08T14:02:05.604Z [success] Done. Processed: 0, Skipped: 0
2404
+
2405
+ ────────────────────────────────────────────────────────────
2406
+ 2026-03-08T14:17:05.754Z [run] started
2407
+ ────────────────────────────────────────────────────────────
2408
+ 2026-03-08T14:17:05.792Z [info] Fetching tasks (filter: all)...
2409
+ 2026-03-08T14:17:06.696Z [info] Found 0 tagged task(s)
2410
+ 2026-03-08T14:17:06.697Z [success] Done. Processed: 0, Skipped: 0
2411
+ 2026-03-08T14:28:16.835Z [warn] cursor clarification check failed — trying next runner
2412
+ 2026-03-08T14:28:16.836Z [warn] cursor clarification check failed — trying next runner
2413
+ 2026-03-08T14:28:16.836Z [warn] windsurf clarification check failed — trying next runner
2414
+ 2026-03-08T14:28:16.837Z [warn] Clarification check failed for all runners — proceeding without clarification
2415
+ 2026-03-08T14:28:16.837Z [warn] No AI runner available — skipping clarification check
2416
+ 2026-03-08T14:28:16.966Z [error] Cannot create branch "task123/fix-bug": expected to be on "main" but currently on "some-other-branch"
2417
+ 2026-03-08T14:28:17.131Z [error] Refusing to commit: expected branch "task123/fix-bug" but currently on "wrong-branch"
2418
+ 2026-03-08T14:28:17.176Z [error] Refusing to commit directly to protected branch "main"
2419
+ 2026-03-08T14:28:17.313Z [error] Refusing to push directly to protected branch "main"
2420
+ 2026-03-08T14:28:17.411Z [error] Refusing to push: current branch "task123/fix-bug" does not match target branch "task456/other-task"
2421
+ 2026-03-08T14:28:18.975Z [error] git pull failed: From /var/folders/88/xzz9sxx15s13cmqq5_1k0t480000gn/T/aidev-bare-wN4L8F
2422
+ * branch main -> FETCH_HEAD
2423
+ hint: You have divergent branches and need to specify how to reconcile them.
2424
+ hint: You can do so by running one of the following commands sometime before
2425
+ hint: your next pull:
2426
+ hint:
2427
+ hint: git config pull.rebase false # merge
2428
+ hint: git config pull.rebase true # rebase
2429
+ hint: git config pull.ff only # fast-forward only
2430
+ hint:
2431
+ hint: You can replace "git config" with "git config --global" to set a default
2432
+ hint: preference for all repositories. You can also pass --rebase, --no-rebase,
2433
+ hint: or --ff-only on the command line to override the configured default per
2434
+ hint: invocation.
2435
+ fatal: Need to specify how to reconcile divergent branches.
2436
+
2437
+ 2026-03-08T14:28:21.598Z [warn] cursor clarification check failed — trying next runner
2438
+ 2026-03-08T14:28:21.601Z [warn] cursor clarification check failed — trying next runner
2439
+ 2026-03-08T14:28:21.602Z [warn] windsurf clarification check failed — trying next runner
2440
+ 2026-03-08T14:28:21.602Z [warn] Clarification check failed for all runners — proceeding without clarification
2441
+ 2026-03-08T14:28:21.602Z [warn] No AI runner available — skipping clarification check
2442
+ 2026-03-08T14:28:21.778Z [error] Cannot create branch "task123/fix-bug": expected to be on "main" but currently on "some-other-branch"
2443
+ 2026-03-08T14:28:21.952Z [error] Refusing to commit: expected branch "task123/fix-bug" but currently on "wrong-branch"
2444
+ 2026-03-08T14:28:21.999Z [error] Refusing to commit directly to protected branch "main"
2445
+ 2026-03-08T14:28:22.153Z [error] Refusing to push directly to protected branch "main"
2446
+ 2026-03-08T14:28:22.252Z [error] Refusing to push: current branch "task123/fix-bug" does not match target branch "task456/other-task"
2447
+ 2026-03-08T14:28:23.834Z [error] git pull failed: From /var/folders/88/xzz9sxx15s13cmqq5_1k0t480000gn/T/aidev-bare-AO54ZD
2448
+ * branch main -> FETCH_HEAD
2449
+ hint: You have divergent branches and need to specify how to reconcile them.
2450
+ hint: You can do so by running one of the following commands sometime before
2451
+ hint: your next pull:
2452
+ hint:
2453
+ hint: git config pull.rebase false # merge
2454
+ hint: git config pull.rebase true # rebase
2455
+ hint: git config pull.ff only # fast-forward only
2456
+ hint:
2457
+ hint: You can replace "git config" with "git config --global" to set a default
2458
+ hint: preference for all repositories. You can also pass --rebase, --no-rebase,
2459
+ hint: or --ff-only on the command line to override the configured default per
2460
+ hint: invocation.
2461
+ fatal: Need to specify how to reconcile divergent branches.
2462
+
2463
+
2464
+ ────────────────────────────────────────────────────────────
2465
+ 2026-03-08T14:32:06.839Z [run] started
2466
+ ────────────────────────────────────────────────────────────
2467
+ 2026-03-08T14:32:06.874Z [info] Fetching tasks (filter: all)...
2468
+ 2026-03-08T14:32:07.306Z [info] Found 0 tagged task(s)
2469
+ 2026-03-08T14:32:07.307Z [success] Done. Processed: 0, Skipped: 0
2470
+ 2026-03-08T14:37:27.285Z [warn] cursor clarification check failed — trying next runner
2471
+ 2026-03-08T14:37:27.286Z [warn] cursor clarification check failed — trying next runner
2472
+ 2026-03-08T14:37:27.286Z [warn] windsurf clarification check failed — trying next runner
2473
+ 2026-03-08T14:37:27.286Z [warn] Clarification check failed for all runners — proceeding without clarification
2474
+ 2026-03-08T14:37:27.286Z [warn] No AI runner available — skipping clarification check
2475
+ 2026-03-08T14:37:27.427Z [error] Cannot create branch "task123/fix-bug": expected to be on "main" but currently on "some-other-branch"
2476
+ 2026-03-08T14:37:27.583Z [error] Refusing to commit: expected branch "task123/fix-bug" but currently on "wrong-branch"
2477
+ 2026-03-08T14:37:27.625Z [error] Refusing to commit directly to protected branch "main"
2478
+ 2026-03-08T14:37:27.756Z [error] Refusing to push directly to protected branch "main"
2479
+ 2026-03-08T14:37:27.842Z [error] Refusing to push: current branch "task123/fix-bug" does not match target branch "task456/other-task"
2480
+ 2026-03-08T14:37:29.245Z [error] git pull failed: From /var/folders/88/xzz9sxx15s13cmqq5_1k0t480000gn/T/aidev-bare-Emf0gt
2481
+ * branch main -> FETCH_HEAD
2482
+ hint: You have divergent branches and need to specify how to reconcile them.
2483
+ hint: You can do so by running one of the following commands sometime before
2484
+ hint: your next pull:
2485
+ hint:
2486
+ hint: git config pull.rebase false # merge
2487
+ hint: git config pull.rebase true # rebase
2488
+ hint: git config pull.ff only # fast-forward only
2489
+ hint:
2490
+ hint: You can replace "git config" with "git config --global" to set a default
2491
+ hint: preference for all repositories. You can also pass --rebase, --no-rebase,
2492
+ hint: or --ff-only on the command line to override the configured default per
2493
+ hint: invocation.
2494
+ fatal: Need to specify how to reconcile divergent branches.
2495
+
2496
+ 2026-03-08T14:42:07.505Z [warn] cursor clarification check failed — trying next runner
2497
+ 2026-03-08T14:42:07.507Z [warn] cursor clarification check failed — trying next runner
2498
+ 2026-03-08T14:42:07.507Z [warn] windsurf clarification check failed — trying next runner
2499
+ 2026-03-08T14:42:07.507Z [warn] Clarification check failed for all runners — proceeding without clarification
2500
+ 2026-03-08T14:42:07.507Z [warn] No AI runner available — skipping clarification check
2501
+ 2026-03-08T14:42:07.657Z [error] Cannot create branch "task123/fix-bug": expected to be on "main" but currently on "some-other-branch"
2502
+ 2026-03-08T14:42:07.835Z [error] Refusing to commit: expected branch "task123/fix-bug" but currently on "wrong-branch"
2503
+ 2026-03-08T14:42:07.877Z [error] Refusing to commit directly to protected branch "main"
2504
+ 2026-03-08T14:42:08.009Z [error] Refusing to push directly to protected branch "main"
2505
+ 2026-03-08T14:42:08.101Z [error] Refusing to push: current branch "task123/fix-bug" does not match target branch "task456/other-task"
2506
+ 2026-03-08T14:42:09.522Z [error] git pull failed: From /var/folders/88/xzz9sxx15s13cmqq5_1k0t480000gn/T/aidev-bare-xouFtk
2507
+ * branch main -> FETCH_HEAD
2508
+ hint: You have divergent branches and need to specify how to reconcile them.
2509
+ hint: You can do so by running one of the following commands sometime before
2510
+ hint: your next pull:
2511
+ hint:
2512
+ hint: git config pull.rebase false # merge
2513
+ hint: git config pull.rebase true # rebase
2514
+ hint: git config pull.ff only # fast-forward only
2515
+ hint:
2516
+ hint: You can replace "git config" with "git config --global" to set a default
2517
+ hint: preference for all repositories. You can also pass --rebase, --no-rebase,
2518
+ hint: or --ff-only on the command line to override the configured default per
2519
+ hint: invocation.
2520
+ fatal: Need to specify how to reconcile divergent branches.
2521
+
@@ -41,6 +41,7 @@ const strict_1 = __importDefault(require("node:assert/strict"));
41
41
  const fs = __importStar(require("node:fs"));
42
42
  const os = __importStar(require("node:os"));
43
43
  const path = __importStar(require("node:path"));
44
+ const dotenv = __importStar(require("dotenv"));
44
45
  const init_1 = require("../commands/init");
45
46
  // ─── envVal ──────────────────────────────────────────────────────────────────
46
47
  (0, node_test_1.describe)('envVal', () => {
@@ -134,6 +135,145 @@ const baseAnswers = {
134
135
  strict_1.default.ok(out.includes('# Global env base'));
135
136
  });
136
137
  });
138
+ // ─── existing env round-trip (edit flow) ─────────────────────────────────────
139
+ //
140
+ // Core guarantee: when the user presses Enter for every prompt during a
141
+ // re-edit, the written .env.aidev must be byte-for-byte identical to the
142
+ // original. We verify this by:
143
+ // 1. renderEnv(answers) → parse with dotenv → feed parsed values back in →
144
+ // renderEnv again → assert equal.
145
+ // This mirrors exactly what initCommand does: it reads the file with
146
+ // dotenv.parse() and uses the result as the `defaultVal` for each prompt.
147
+ /** Reconstruct an Answers object from a dotenv-parsed record (same logic as initCommand). */
148
+ function answersFromParsed(p, folderName = 'myproject') {
149
+ return {
150
+ provider: (p.PROVIDER || 'clickup'),
151
+ aidevEnvExtend: p.AIDEV_ENV_EXTEND || '',
152
+ clickupApiKey: p.CLICKUP_API_KEY || '',
153
+ clickupTeamId: p.CLICKUP_TEAM_ID || '',
154
+ clickupTag: p.CLICKUP_TAG || folderName,
155
+ clickupPendingStatus: p.CLICKUP_PENDING_STATUS || 'pending',
156
+ clickupInReviewStatus: p.CLICKUP_IN_REVIEW_STATUS || 'review',
157
+ jiraBaseUrl: p.JIRA_BASE_URL || '',
158
+ jiraEmail: p.JIRA_EMAIL || '',
159
+ jiraApiToken: p.JIRA_API_TOKEN || '',
160
+ jiraProject: p.JIRA_PROJECT || '',
161
+ jiraLabel: p.JIRA_LABEL || folderName,
162
+ jiraPendingStatus: p.JIRA_PENDING_STATUS || 'To Do',
163
+ jiraInReviewStatus: p.JIRA_IN_REVIEW_STATUS || 'In Review',
164
+ assigneeTag: p.ASSIGNEE_TAG || '',
165
+ gitRemote: p.GIT_REMOTE || 'origin',
166
+ githubBaseBranch: p.GITHUB_BASE_BRANCH || 'main',
167
+ githubRepo: p.GITHUB_REPO || '',
168
+ agents: p.AGENTS || '',
169
+ devNotesMode: p.DEV_NOTES_MODE || 'smart',
170
+ triggerWord: p.AIDEV_TRIGGER_WORD || 'aidev-continue',
171
+ thinkingTag: p.THINKING_TAG || '',
172
+ };
173
+ }
174
+ (0, node_test_1.describe)('existing env round-trip (edit flow)', () => {
175
+ (0, node_test_1.it)('dotenv.parse recovers all ClickUp field values from rendered output', () => {
176
+ const out = (0, init_1.renderEnv)(baseAnswers);
177
+ const p = dotenv.parse(out);
178
+ strict_1.default.equal(p.PROVIDER, 'clickup');
179
+ strict_1.default.equal(p.CLICKUP_API_KEY, 'pk_abc123');
180
+ strict_1.default.equal(p.CLICKUP_TEAM_ID, 'team_456');
181
+ strict_1.default.equal(p.CLICKUP_TAG, 'myproject');
182
+ strict_1.default.equal(p.CLICKUP_PENDING_STATUS, 'pending');
183
+ strict_1.default.equal(p.CLICKUP_IN_REVIEW_STATUS, 'review');
184
+ strict_1.default.equal(p.GIT_REMOTE, 'origin');
185
+ strict_1.default.equal(p.GITHUB_BASE_BRANCH, 'main');
186
+ strict_1.default.equal(p.GITHUB_REPO, 'owner/repo');
187
+ strict_1.default.equal(p.AGENTS, 'claude,cursor');
188
+ strict_1.default.equal(p.DEV_NOTES_MODE, 'smart');
189
+ strict_1.default.equal(p.AIDEV_TRIGGER_WORD, 'aidev-continue');
190
+ });
191
+ (0, node_test_1.it)('re-rendering ClickUp answers with parsed values produces identical output', () => {
192
+ const first = (0, init_1.renderEnv)(baseAnswers);
193
+ const second = (0, init_1.renderEnv)(answersFromParsed(dotenv.parse(first)));
194
+ strict_1.default.equal(second, first);
195
+ });
196
+ (0, node_test_1.it)('re-rendering Jira answers with parsed values produces identical output', () => {
197
+ const jiraAnswers = {
198
+ ...baseAnswers,
199
+ provider: 'jira',
200
+ clickupApiKey: '',
201
+ clickupTeamId: '',
202
+ clickupTag: '',
203
+ clickupPendingStatus: '',
204
+ clickupInReviewStatus: '',
205
+ jiraBaseUrl: 'https://acme.atlassian.net',
206
+ jiraEmail: 'dev@acme.com',
207
+ jiraApiToken: 'tok_secret',
208
+ jiraProject: 'PROJ',
209
+ jiraLabel: 'aidev',
210
+ jiraPendingStatus: 'To Do',
211
+ jiraInReviewStatus: 'In Review',
212
+ };
213
+ const first = (0, init_1.renderEnv)(jiraAnswers);
214
+ const second = (0, init_1.renderEnv)(answersFromParsed(dotenv.parse(first)));
215
+ strict_1.default.equal(second, first);
216
+ });
217
+ (0, node_test_1.it)('quoted values (spaces) survive parse → re-render', () => {
218
+ const answers = {
219
+ ...baseAnswers,
220
+ clickupPendingStatus: 'needs info',
221
+ clickupInReviewStatus: 'in review',
222
+ };
223
+ const first = (0, init_1.renderEnv)(answers);
224
+ const parsed = dotenv.parse(first);
225
+ // dotenv strips quotes — parsed values should be plain strings
226
+ strict_1.default.equal(parsed.CLICKUP_PENDING_STATUS, 'needs info');
227
+ strict_1.default.equal(parsed.CLICKUP_IN_REVIEW_STATUS, 'in review');
228
+ const second = (0, init_1.renderEnv)(answersFromParsed(parsed));
229
+ strict_1.default.equal(second, first);
230
+ });
231
+ (0, node_test_1.it)('AIDEV_ENV_EXTEND survives parse → re-render', () => {
232
+ const answers = { ...baseAnswers, aidevEnvExtend: '/home/user/.aidev.global' };
233
+ const first = (0, init_1.renderEnv)(answers);
234
+ const second = (0, init_1.renderEnv)(answersFromParsed(dotenv.parse(first)));
235
+ strict_1.default.equal(second, first);
236
+ });
237
+ (0, node_test_1.it)('assigneeTag survives parse → re-render', () => {
238
+ const answers = { ...baseAnswers, assigneeTag: 'alice <alice@example.com>' };
239
+ const first = (0, init_1.renderEnv)(answers);
240
+ const parsed = dotenv.parse(first);
241
+ strict_1.default.equal(parsed.ASSIGNEE_TAG, 'alice <alice@example.com>');
242
+ const second = (0, init_1.renderEnv)(answersFromParsed(parsed));
243
+ strict_1.default.equal(second, first);
244
+ });
245
+ (0, node_test_1.it)('changing one field during edit leaves all others unchanged', () => {
246
+ const first = (0, init_1.renderEnv)(baseAnswers);
247
+ const parsed = dotenv.parse(first);
248
+ // Simulate user typing a new value only for CLICKUP_TAG
249
+ const editedAnswers = answersFromParsed(parsed);
250
+ editedAnswers.clickupTag = 'new-tag';
251
+ const second = (0, init_1.renderEnv)(editedAnswers);
252
+ const p2 = dotenv.parse(second);
253
+ strict_1.default.equal(p2.CLICKUP_TAG, 'new-tag');
254
+ // Everything else unchanged
255
+ strict_1.default.equal(p2.CLICKUP_API_KEY, parsed.CLICKUP_API_KEY);
256
+ strict_1.default.equal(p2.CLICKUP_TEAM_ID, parsed.CLICKUP_TEAM_ID);
257
+ strict_1.default.equal(p2.AGENTS, parsed.AGENTS);
258
+ strict_1.default.equal(p2.GIT_REMOTE, parsed.GIT_REMOTE);
259
+ strict_1.default.equal(p2.GITHUB_BASE_BRANCH, parsed.GITHUB_BASE_BRANCH);
260
+ });
261
+ (0, node_test_1.it)('THINKING_TAG survives parse → re-render when set', () => {
262
+ const answers = { ...baseAnswers, thinkingTag: 'think' };
263
+ const first = (0, init_1.renderEnv)(answers);
264
+ const parsed = dotenv.parse(first);
265
+ strict_1.default.equal(parsed.THINKING_TAG, 'think');
266
+ const second = (0, init_1.renderEnv)(answersFromParsed(parsed));
267
+ strict_1.default.equal(second, first);
268
+ });
269
+ (0, node_test_1.it)('empty optional fields are absent from parsed output (no stale keys)', () => {
270
+ const out = (0, init_1.renderEnv)(baseAnswers); // assigneeTag='', thinkingTag='', aidevEnvExtend=''
271
+ const p = dotenv.parse(out);
272
+ strict_1.default.ok(!('ASSIGNEE_TAG' in p), 'ASSIGNEE_TAG should be absent when empty');
273
+ strict_1.default.ok(!('AIDEV_ENV_EXTEND' in p), 'AIDEV_ENV_EXTEND should be absent when empty');
274
+ strict_1.default.ok(!('THINKING_TAG' in p), 'THINKING_TAG should be absent when empty');
275
+ });
276
+ });
137
277
  // ─── ensureGitignore ─────────────────────────────────────────────────────────
138
278
  function withTmpDir(fn) {
139
279
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'aidev-test-'));
@@ -1 +1 @@
1
- {"version":3,"file":"init.test.js","sourceRoot":"","sources":["../../src/__tests__/init.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAyC;AACzC,gEAAwC;AACxC,4CAA8B;AAC9B,4CAA8B;AAC9B,gDAAkC;AAClC,2CAA+E;AAE/E,gFAAgF;AAEhF,IAAA,oBAAQ,EAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,IAAA,cAAE,EAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,gBAAM,CAAC,KAAK,CAAC,IAAA,aAAM,EAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,IAAA,cAAE,EAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,gBAAM,CAAC,KAAK,CAAC,IAAA,aAAM,EAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,IAAA,cAAE,EAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,gBAAM,CAAC,KAAK,CAAC,IAAA,aAAM,EAAC,eAAe,CAAC,EAAE,iBAAiB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,IAAA,cAAE,EAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,gBAAM,CAAC,KAAK,CAAC,IAAA,aAAM,EAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAA,cAAE,EAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,gBAAM,CAAC,KAAK,CAAC,IAAA,aAAM,EAAC,UAAU,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAA,cAAE,EAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,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 +1 @@
1
+ {"version":3,"file":"lockfile.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/lockfile.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const node_test_1 = require("node:test");
40
+ const strict_1 = __importDefault(require("node:assert/strict"));
41
+ const fs = __importStar(require("node:fs"));
42
+ const os = __importStar(require("node:os"));
43
+ const path = __importStar(require("node:path"));
44
+ const lockfile_1 = require("../lockfile");
45
+ // ─── helpers ──────────────────────────────────────────────────────────────────
46
+ let tmpDir;
47
+ function writeLock(cwd, pid) {
48
+ fs.writeFileSync((0, lockfile_1.lockfilePath)(cwd), String(pid), 'utf8');
49
+ }
50
+ // ─── setup / teardown ─────────────────────────────────────────────────────────
51
+ (0, node_test_1.before)(() => {
52
+ tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'aidev-lock-test-'));
53
+ });
54
+ (0, node_test_1.afterEach)(() => {
55
+ // Clean up lock file between tests
56
+ try {
57
+ fs.unlinkSync((0, lockfile_1.lockfilePath)(tmpDir));
58
+ }
59
+ catch { /* ok */ }
60
+ });
61
+ (0, node_test_1.after)(() => {
62
+ try {
63
+ fs.rmdirSync(tmpDir);
64
+ }
65
+ catch { /* ok */ }
66
+ });
67
+ // ─── lockfilePath ─────────────────────────────────────────────────────────────
68
+ (0, node_test_1.describe)('lockfilePath', () => {
69
+ (0, node_test_1.it)('returns path ending with LOCK_FILENAME inside cwd', () => {
70
+ const p = (0, lockfile_1.lockfilePath)('/some/dir');
71
+ strict_1.default.equal(p, `/some/dir/${lockfile_1.LOCK_FILENAME}`);
72
+ });
73
+ });
74
+ // ─── isProcessAlive ───────────────────────────────────────────────────────────
75
+ (0, node_test_1.describe)('isProcessAlive', () => {
76
+ (0, node_test_1.it)('returns true for the current process', () => {
77
+ strict_1.default.equal((0, lockfile_1.isProcessAlive)(process.pid), true);
78
+ });
79
+ (0, node_test_1.it)('returns false for a PID that does not exist', () => {
80
+ // PID 0 is the kernel — kill(0, 0) targets the current process group,
81
+ // so use a very high number that is almost certainly unused.
82
+ // We rely on errno ESRCH (no such process).
83
+ strict_1.default.equal((0, lockfile_1.isProcessAlive)(999999999), false);
84
+ });
85
+ });
86
+ // ─── readLock ─────────────────────────────────────────────────────────────────
87
+ (0, node_test_1.describe)('readLock', () => {
88
+ (0, node_test_1.it)('returns null when no lock file exists', () => {
89
+ strict_1.default.equal((0, lockfile_1.readLock)(tmpDir), null);
90
+ });
91
+ (0, node_test_1.it)('returns the PID stored in the lock file', () => {
92
+ writeLock(tmpDir, 1234);
93
+ strict_1.default.equal((0, lockfile_1.readLock)(tmpDir), 1234);
94
+ });
95
+ (0, node_test_1.it)('returns null for non-numeric content', () => {
96
+ fs.writeFileSync((0, lockfile_1.lockfilePath)(tmpDir), 'not-a-pid', 'utf8');
97
+ strict_1.default.equal((0, lockfile_1.readLock)(tmpDir), null);
98
+ });
99
+ });
100
+ // ─── acquireLock ──────────────────────────────────────────────────────────────
101
+ (0, node_test_1.describe)('acquireLock', () => {
102
+ (0, node_test_1.it)('succeeds when no lock file exists', () => {
103
+ const ok = (0, lockfile_1.acquireLock)(tmpDir);
104
+ strict_1.default.equal(ok, true);
105
+ strict_1.default.equal((0, lockfile_1.readLock)(tmpDir), process.pid);
106
+ });
107
+ (0, node_test_1.it)('succeeds and overwrites a stale lock file (dead PID)', () => {
108
+ writeLock(tmpDir, 999999999); // dead PID
109
+ const ok = (0, lockfile_1.acquireLock)(tmpDir);
110
+ strict_1.default.equal(ok, true);
111
+ strict_1.default.equal((0, lockfile_1.readLock)(tmpDir), process.pid);
112
+ });
113
+ (0, node_test_1.it)('fails when a live process holds the lock', () => {
114
+ writeLock(tmpDir, process.pid); // current process = alive
115
+ const ok = (0, lockfile_1.acquireLock)(tmpDir);
116
+ strict_1.default.equal(ok, false);
117
+ });
118
+ });
119
+ // ─── releaseLock ──────────────────────────────────────────────────────────────
120
+ (0, node_test_1.describe)('releaseLock', () => {
121
+ (0, node_test_1.it)('removes the lock file', () => {
122
+ writeLock(tmpDir, process.pid);
123
+ (0, lockfile_1.releaseLock)(tmpDir);
124
+ strict_1.default.equal(fs.existsSync((0, lockfile_1.lockfilePath)(tmpDir)), false);
125
+ });
126
+ (0, node_test_1.it)('does not throw when the file is already absent', () => {
127
+ strict_1.default.doesNotThrow(() => (0, lockfile_1.releaseLock)(tmpDir));
128
+ });
129
+ });
130
+ // ─── stopProcess ──────────────────────────────────────────────────────────────
131
+ (0, node_test_1.describe)('stopProcess', () => {
132
+ (0, node_test_1.it)('returns "no-lock" when no lock file exists', () => {
133
+ strict_1.default.equal((0, lockfile_1.stopProcess)(tmpDir), 'no-lock');
134
+ });
135
+ (0, node_test_1.it)('returns "not-running" and removes a stale lock', () => {
136
+ writeLock(tmpDir, 999999999); // dead PID
137
+ const result = (0, lockfile_1.stopProcess)(tmpDir);
138
+ strict_1.default.equal(result, 'not-running');
139
+ strict_1.default.equal(fs.existsSync((0, lockfile_1.lockfilePath)(tmpDir)), false);
140
+ });
141
+ // Note: we cannot test 'killed' safely in a unit test without spawning a
142
+ // real child process, so the live-kill path is exercised by integration tests.
143
+ });
144
+ //# sourceMappingURL=lockfile.test.js.map