@qelos/aidev 0.1.15 → 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.
Files changed (41) hide show
  1. package/.env.aidev.example +8 -0
  2. package/README.md +53 -0
  3. package/aidev.log +478 -0
  4. package/dist/__tests__/config.test.d.ts +2 -0
  5. package/dist/__tests__/config.test.d.ts.map +1 -0
  6. package/dist/__tests__/config.test.js +272 -0
  7. package/dist/__tests__/config.test.js.map +1 -0
  8. package/dist/__tests__/init.test.js +157 -0
  9. package/dist/__tests__/init.test.js.map +1 -1
  10. package/dist/__tests__/lockfile.test.d.ts +2 -0
  11. package/dist/__tests__/lockfile.test.d.ts.map +1 -0
  12. package/dist/__tests__/lockfile.test.js +144 -0
  13. package/dist/__tests__/lockfile.test.js.map +1 -0
  14. package/dist/__tests__/schedule.test.js +58 -0
  15. package/dist/__tests__/schedule.test.js.map +1 -1
  16. package/dist/cli.js +13 -0
  17. package/dist/cli.js.map +1 -1
  18. package/dist/commands/init.d.ts +1 -0
  19. package/dist/commands/init.d.ts.map +1 -1
  20. package/dist/commands/init.js +44 -29
  21. package/dist/commands/init.js.map +1 -1
  22. package/dist/commands/run.d.ts.map +1 -1
  23. package/dist/commands/run.js +29 -17
  24. package/dist/commands/run.js.map +1 -1
  25. package/dist/commands/schedule.d.ts +3 -0
  26. package/dist/commands/schedule.d.ts.map +1 -1
  27. package/dist/commands/schedule.js +93 -0
  28. package/dist/commands/schedule.js.map +1 -1
  29. package/dist/commands/stop.d.ts +2 -0
  30. package/dist/commands/stop.d.ts.map +1 -0
  31. package/dist/commands/stop.js +20 -0
  32. package/dist/commands/stop.js.map +1 -0
  33. package/dist/config.d.ts +19 -0
  34. package/dist/config.d.ts.map +1 -1
  35. package/dist/config.js +96 -3
  36. package/dist/config.js.map +1 -1
  37. package/dist/lockfile.d.ts +23 -0
  38. package/dist/lockfile.d.ts.map +1 -0
  39. package/dist/lockfile.js +105 -0
  40. package/dist/lockfile.js.map +1 -0
  41. package/package.json +2 -2
@@ -0,0 +1,23 @@
1
+ export declare const LOCK_FILENAME = ".aidev.lock";
2
+ export declare function lockfilePath(cwd: string): string;
3
+ /** Returns true if the given PID corresponds to a running process. */
4
+ export declare function isProcessAlive(pid: number): boolean;
5
+ /**
6
+ * Read the PID stored in the lock file.
7
+ * Returns null if the file does not exist or its content is not a valid integer.
8
+ */
9
+ export declare function readLock(cwd: string): number | null;
10
+ /**
11
+ * Try to acquire the lock for `cwd`.
12
+ * Returns true on success, false if another live process already holds it.
13
+ */
14
+ export declare function acquireLock(cwd: string): boolean;
15
+ /** Remove the lock file for `cwd`. Safe to call even if file is absent. */
16
+ export declare function releaseLock(cwd: string): void;
17
+ /**
18
+ * Stop the process that holds the lock for `cwd`.
19
+ * Returns 'killed' | 'not-running' | 'no-lock'.
20
+ */
21
+ export type StopResult = 'killed' | 'not-running' | 'no-lock';
22
+ export declare function stopProcess(cwd: string): StopResult;
23
+ //# sourceMappingURL=lockfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockfile.d.ts","sourceRoot":"","sources":["../src/lockfile.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAE3C,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMnD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQhD;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAM7C;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC;AAE9D,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAUnD"}
@@ -0,0 +1,105 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.LOCK_FILENAME = void 0;
37
+ exports.lockfilePath = lockfilePath;
38
+ exports.isProcessAlive = isProcessAlive;
39
+ exports.readLock = readLock;
40
+ exports.acquireLock = acquireLock;
41
+ exports.releaseLock = releaseLock;
42
+ exports.stopProcess = stopProcess;
43
+ const fs = __importStar(require("node:fs"));
44
+ const path = __importStar(require("node:path"));
45
+ exports.LOCK_FILENAME = '.aidev.lock';
46
+ function lockfilePath(cwd) {
47
+ return path.join(cwd, exports.LOCK_FILENAME);
48
+ }
49
+ /** Returns true if the given PID corresponds to a running process. */
50
+ function isProcessAlive(pid) {
51
+ try {
52
+ process.kill(pid, 0);
53
+ return true;
54
+ }
55
+ catch {
56
+ return false;
57
+ }
58
+ }
59
+ /**
60
+ * Read the PID stored in the lock file.
61
+ * Returns null if the file does not exist or its content is not a valid integer.
62
+ */
63
+ function readLock(cwd) {
64
+ const p = lockfilePath(cwd);
65
+ if (!fs.existsSync(p))
66
+ return null;
67
+ const raw = fs.readFileSync(p, 'utf8').trim();
68
+ const pid = parseInt(raw, 10);
69
+ return isNaN(pid) ? null : pid;
70
+ }
71
+ /**
72
+ * Try to acquire the lock for `cwd`.
73
+ * Returns true on success, false if another live process already holds it.
74
+ */
75
+ function acquireLock(cwd) {
76
+ const existing = readLock(cwd);
77
+ if (existing !== null && isProcessAlive(existing)) {
78
+ return false;
79
+ }
80
+ // Write our PID (overwriting stale lock if present)
81
+ fs.writeFileSync(lockfilePath(cwd), String(process.pid), 'utf8');
82
+ return true;
83
+ }
84
+ /** Remove the lock file for `cwd`. Safe to call even if file is absent. */
85
+ function releaseLock(cwd) {
86
+ try {
87
+ fs.unlinkSync(lockfilePath(cwd));
88
+ }
89
+ catch {
90
+ // already removed or never existed
91
+ }
92
+ }
93
+ function stopProcess(cwd) {
94
+ const pid = readLock(cwd);
95
+ if (pid === null)
96
+ return 'no-lock';
97
+ if (!isProcessAlive(pid)) {
98
+ releaseLock(cwd);
99
+ return 'not-running';
100
+ }
101
+ process.kill(pid, 'SIGTERM');
102
+ releaseLock(cwd);
103
+ return 'killed';
104
+ }
105
+ //# sourceMappingURL=lockfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockfile.js","sourceRoot":"","sources":["../src/lockfile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,oCAEC;AAGD,wCAOC;AAMD,4BAMC;AAMD,kCAQC;AAGD,kCAMC;AAQD,kC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2EAA2E;AAC3E,SAAgB,WAAW,CAAC,GAAW;IACrC,IAAI,CAAC;QACH,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,mCAAmC;IACrC,CAAC;AACH,CAAC;AAQD,SAAgB,WAAW,CAAC,GAAW;IACrC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACnC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,WAAW,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC7B,WAAW,CAAC,GAAG,CAAC,CAAC;IACjB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qelos/aidev",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "AI-powered task executor — polls ClickUp (and more) to implement tasks with Claude or Cursor",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  "node": ">=22.0.0"
12
12
  },
13
13
  "scripts": {
14
- "build": "tsc && node -e \"if(process.platform!=='win32')require('fs').chmodSync('dist/cli.js',0o755)\"",
14
+ "build": "tsc && node -e \"if(process.platform!=='win32')require('node:fs').chmodSync('dist/cli.js',0o755)\"",
15
15
  "dev": "tsx src/cli.ts",
16
16
  "test": "node --require tsx/cjs --test 'src/__tests__/**/*.test.ts'",
17
17
  "prepublishOnly": "npm run build"