@mono-labs/tracker 0.1.274 → 0.1.280

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 (114) hide show
  1. package/dist/dashboard/cli.js +42 -0
  2. package/dist/dashboard/server.d.ts.map +1 -1
  3. package/dist/dashboard/server.js +466 -3
  4. package/dist/dashboard/watcher.d.ts +1 -1
  5. package/dist/dashboard/watcher.d.ts.map +1 -1
  6. package/dist/dashboard/watcher.js +1 -1
  7. package/dist/executor/action-executor.d.ts +3 -3
  8. package/dist/executor/action-executor.d.ts.map +1 -1
  9. package/dist/executor/action-executor.js +2 -2
  10. package/dist/executor/actions/extract-action.d.ts +4 -0
  11. package/dist/executor/actions/extract-action.d.ts.map +1 -0
  12. package/dist/executor/actions/extract-action.js +85 -0
  13. package/dist/executor/actions/index.d.ts +4 -0
  14. package/dist/executor/actions/index.d.ts.map +1 -1
  15. package/dist/executor/actions/index.js +9 -1
  16. package/dist/executor/actions/insert-action.d.ts +4 -0
  17. package/dist/executor/actions/insert-action.d.ts.map +1 -0
  18. package/dist/executor/actions/insert-action.js +74 -0
  19. package/dist/executor/actions/move-action.d.ts +4 -0
  20. package/dist/executor/actions/move-action.d.ts.map +1 -0
  21. package/dist/executor/actions/move-action.js +83 -0
  22. package/dist/executor/actions/remove-action.d.ts +2 -2
  23. package/dist/executor/actions/remove-action.d.ts.map +1 -1
  24. package/dist/executor/actions/remove-action.js +70 -6
  25. package/dist/executor/actions/rename-action.d.ts +2 -2
  26. package/dist/executor/actions/rename-action.d.ts.map +1 -1
  27. package/dist/executor/actions/rename-action.js +69 -6
  28. package/dist/executor/actions/replace-action.d.ts +2 -2
  29. package/dist/executor/actions/replace-action.d.ts.map +1 -1
  30. package/dist/executor/actions/replace-action.js +65 -6
  31. package/dist/executor/actions/wrap-action.d.ts +4 -0
  32. package/dist/executor/actions/wrap-action.d.ts.map +1 -0
  33. package/dist/executor/actions/wrap-action.js +97 -0
  34. package/dist/executor/index.d.ts +1 -1
  35. package/dist/executor/index.d.ts.map +1 -1
  36. package/dist/executor/index.js +21 -1
  37. package/dist/governance/deprecation-tracker.d.ts +21 -0
  38. package/dist/governance/deprecation-tracker.d.ts.map +1 -0
  39. package/dist/governance/deprecation-tracker.js +55 -0
  40. package/dist/governance/index.d.ts +5 -0
  41. package/dist/governance/index.d.ts.map +1 -0
  42. package/dist/governance/index.js +7 -0
  43. package/dist/governance/security-gate.d.ts +15 -0
  44. package/dist/governance/security-gate.d.ts.map +1 -0
  45. package/dist/governance/security-gate.js +40 -0
  46. package/dist/governance/security-gate.test.d.ts +2 -0
  47. package/dist/governance/security-gate.test.d.ts.map +1 -0
  48. package/dist/governance/security-gate.test.js +67 -0
  49. package/dist/index.d.ts +13 -6
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +20 -1
  52. package/dist/integrations/ai-suggest.d.ts +8 -0
  53. package/dist/integrations/ai-suggest.d.ts.map +1 -0
  54. package/dist/integrations/ai-suggest.js +106 -0
  55. package/dist/integrations/github-issues.d.ts +8 -0
  56. package/dist/integrations/github-issues.d.ts.map +1 -0
  57. package/dist/integrations/github-issues.js +84 -0
  58. package/dist/integrations/index.d.ts +5 -0
  59. package/dist/integrations/index.d.ts.map +1 -0
  60. package/dist/integrations/index.js +9 -0
  61. package/dist/integrations/jira-issues.d.ts +8 -0
  62. package/dist/integrations/jira-issues.d.ts.map +1 -0
  63. package/dist/integrations/jira-issues.js +93 -0
  64. package/dist/manager/health-score.d.ts +3 -0
  65. package/dist/manager/health-score.d.ts.map +1 -0
  66. package/dist/manager/health-score.js +32 -0
  67. package/dist/manager/index.d.ts +3 -0
  68. package/dist/manager/index.d.ts.map +1 -1
  69. package/dist/manager/index.js +5 -1
  70. package/dist/manager/notation-manager.test.js +5 -1
  71. package/dist/manager/projection.d.ts +15 -0
  72. package/dist/manager/projection.d.ts.map +1 -0
  73. package/dist/manager/projection.js +56 -0
  74. package/dist/scanner/action-serializer.d.ts +4 -0
  75. package/dist/scanner/action-serializer.d.ts.map +1 -0
  76. package/dist/scanner/action-serializer.js +54 -0
  77. package/dist/scanner/attribute-parser.d.ts +2 -0
  78. package/dist/scanner/attribute-parser.d.ts.map +1 -1
  79. package/dist/scanner/attribute-parser.js +11 -0
  80. package/dist/scanner/git-blame.d.ts +3 -0
  81. package/dist/scanner/git-blame.d.ts.map +1 -0
  82. package/dist/scanner/git-blame.js +81 -0
  83. package/dist/scanner/index.d.ts +1 -0
  84. package/dist/scanner/index.d.ts.map +1 -1
  85. package/dist/scanner/index.js +4 -1
  86. package/dist/scanner/notation-parser.d.ts.map +1 -1
  87. package/dist/scanner/notation-parser.js +3 -1
  88. package/dist/storage/config-loader.d.ts +6 -0
  89. package/dist/storage/config-loader.d.ts.map +1 -1
  90. package/dist/storage/config-loader.js +10 -0
  91. package/dist/storage/index.d.ts +4 -1
  92. package/dist/storage/index.d.ts.map +1 -1
  93. package/dist/storage/index.js +4 -1
  94. package/dist/storage/snapshot-storage.d.ts +16 -0
  95. package/dist/storage/snapshot-storage.d.ts.map +1 -0
  96. package/dist/storage/snapshot-storage.js +106 -0
  97. package/dist/storage/snapshot-storage.test.d.ts +2 -0
  98. package/dist/storage/snapshot-storage.test.d.ts.map +1 -0
  99. package/dist/storage/snapshot-storage.test.js +117 -0
  100. package/dist/types/config.d.ts +22 -0
  101. package/dist/types/config.d.ts.map +1 -1
  102. package/dist/types/config.js +5 -1
  103. package/dist/types/enums.d.ts +1 -0
  104. package/dist/types/enums.d.ts.map +1 -1
  105. package/dist/types/enums.js +1 -0
  106. package/dist/types/index.d.ts +1 -1
  107. package/dist/types/index.d.ts.map +1 -1
  108. package/dist/types/notation.d.ts +9 -0
  109. package/dist/types/notation.d.ts.map +1 -1
  110. package/dist-dashboard/assets/index-CzsCRhkp.js +197 -0
  111. package/dist-dashboard/assets/index-DUqAN9SG.css +1 -0
  112. package/dist-dashboard/index.html +12 -1
  113. package/package.json +33 -8
  114. package/dist-dashboard/assets/index-Bi4tCz8P.js +0 -62
@@ -0,0 +1,85 @@
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.handleExtract = handleExtract;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ async function handleExtract(action, notation, projectRoot) {
40
+ const args = action.args;
41
+ if (!args.target || !args.destination) {
42
+ return { success: false, message: 'Extract action requires target and destination', verb: 'extract' };
43
+ }
44
+ try {
45
+ const filePath = path.resolve(projectRoot, notation.location.file);
46
+ const content = fs.readFileSync(filePath, 'utf-8');
47
+ const lines = content.split('\n');
48
+ const startLine = notation.location.line - 1;
49
+ const endLine = (notation.location.endLine ?? notation.location.line + notation.codeContext.length) - 1;
50
+ const searchEnd = Math.min(endLine + 10, lines.length - 1);
51
+ // Find the target code block
52
+ let extractStart = -1;
53
+ for (let i = startLine; i <= searchEnd; i++) {
54
+ if (lines[i].includes(args.target)) {
55
+ extractStart = i;
56
+ break;
57
+ }
58
+ }
59
+ if (extractStart === -1) {
60
+ return { success: false, message: `Target "${args.target}" not found in code context`, verb: 'extract' };
61
+ }
62
+ // Extract the line (simple single-line extraction)
63
+ const extracted = lines[extractStart];
64
+ // Write to destination file
65
+ const destPath = path.resolve(projectRoot, args.destination);
66
+ const destDir = path.dirname(destPath);
67
+ fs.mkdirSync(destDir, { recursive: true });
68
+ let destContent = '';
69
+ try {
70
+ destContent = fs.readFileSync(destPath, 'utf-8');
71
+ }
72
+ catch {
73
+ // File doesn't exist yet
74
+ }
75
+ destContent = destContent ? destContent + '\n' + extracted + '\n' : extracted + '\n';
76
+ fs.writeFileSync(destPath, destContent, 'utf-8');
77
+ // Remove from source
78
+ lines.splice(extractStart, 1);
79
+ fs.writeFileSync(filePath, lines.join('\n'), 'utf-8');
80
+ return { success: true, message: `Extracted "${args.target}" to ${args.destination}`, verb: 'extract' };
81
+ }
82
+ catch (err) {
83
+ return { success: false, message: `Extract failed: ${err.message}`, verb: 'extract' };
84
+ }
85
+ }
@@ -1,4 +1,8 @@
1
1
  export { handleReplace } from './replace-action';
2
2
  export { handleRemove } from './remove-action';
3
3
  export { handleRename } from './rename-action';
4
+ export { handleInsert } from './insert-action';
5
+ export { handleExtract } from './extract-action';
6
+ export { handleMove } from './move-action';
7
+ export { handleWrap } from './wrap-action';
4
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA"}
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleRename = exports.handleRemove = exports.handleReplace = void 0;
3
+ exports.handleWrap = exports.handleMove = exports.handleExtract = exports.handleInsert = exports.handleRename = exports.handleRemove = exports.handleReplace = void 0;
4
4
  var replace_action_1 = require("./replace-action");
5
5
  Object.defineProperty(exports, "handleReplace", { enumerable: true, get: function () { return replace_action_1.handleReplace; } });
6
6
  var remove_action_1 = require("./remove-action");
7
7
  Object.defineProperty(exports, "handleRemove", { enumerable: true, get: function () { return remove_action_1.handleRemove; } });
8
8
  var rename_action_1 = require("./rename-action");
9
9
  Object.defineProperty(exports, "handleRename", { enumerable: true, get: function () { return rename_action_1.handleRename; } });
10
+ var insert_action_1 = require("./insert-action");
11
+ Object.defineProperty(exports, "handleInsert", { enumerable: true, get: function () { return insert_action_1.handleInsert; } });
12
+ var extract_action_1 = require("./extract-action");
13
+ Object.defineProperty(exports, "handleExtract", { enumerable: true, get: function () { return extract_action_1.handleExtract; } });
14
+ var move_action_1 = require("./move-action");
15
+ Object.defineProperty(exports, "handleMove", { enumerable: true, get: function () { return move_action_1.handleMove; } });
16
+ var wrap_action_1 = require("./wrap-action");
17
+ Object.defineProperty(exports, "handleWrap", { enumerable: true, get: function () { return wrap_action_1.handleWrap; } });
@@ -0,0 +1,4 @@
1
+ import type { NotationAction, Notation } from '../../types';
2
+ import type { ActionResult } from '../action-executor';
3
+ export declare function handleInsert(action: NotationAction, notation: Notation, projectRoot: string): Promise<ActionResult>;
4
+ //# sourceMappingURL=insert-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert-action.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/insert-action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAc,MAAM,aAAa,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAoCzH"}
@@ -0,0 +1,74 @@
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.handleInsert = handleInsert;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ async function handleInsert(action, notation, projectRoot) {
40
+ const args = action.args;
41
+ if (!args.content) {
42
+ return { success: false, message: 'Insert action requires content', verb: 'insert' };
43
+ }
44
+ try {
45
+ const filePath = path.resolve(projectRoot, notation.location.file);
46
+ const content = fs.readFileSync(filePath, 'utf-8');
47
+ const lines = content.split('\n');
48
+ const startLine = notation.location.line - 1;
49
+ const endLine = (notation.location.endLine ?? notation.location.line + notation.codeContext.length) - 1;
50
+ const searchEnd = Math.min(endLine + 10, lines.length - 1);
51
+ if (args.anchor) {
52
+ // Find the anchor line and insert before/after
53
+ for (let i = startLine; i <= searchEnd; i++) {
54
+ if (lines[i].includes(args.anchor)) {
55
+ const insertIdx = args.position === 'before' ? i : i + 1;
56
+ lines.splice(insertIdx, 0, args.content);
57
+ fs.writeFileSync(filePath, lines.join('\n'), 'utf-8');
58
+ return { success: true, message: `Inserted content ${args.position} "${args.anchor}"`, verb: 'insert' };
59
+ }
60
+ }
61
+ return { success: false, message: `Anchor "${args.anchor}" not found in code context`, verb: 'insert' };
62
+ }
63
+ else {
64
+ // Insert after the notation block
65
+ const insertIdx = endLine + 1;
66
+ lines.splice(insertIdx, 0, args.content);
67
+ fs.writeFileSync(filePath, lines.join('\n'), 'utf-8');
68
+ return { success: true, message: 'Inserted content after notation block', verb: 'insert' };
69
+ }
70
+ }
71
+ catch (err) {
72
+ return { success: false, message: `Insert failed: ${err.message}`, verb: 'insert' };
73
+ }
74
+ }
@@ -0,0 +1,4 @@
1
+ import type { NotationAction, Notation } from '../../types';
2
+ import type { ActionResult } from '../action-executor';
3
+ export declare function handleMove(action: NotationAction, notation: Notation, projectRoot: string): Promise<ActionResult>;
4
+ //# sourceMappingURL=move-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-action.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/move-action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAY,MAAM,aAAa,CAAA;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAsB,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAoDvH"}
@@ -0,0 +1,83 @@
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.handleMove = handleMove;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ async function handleMove(action, notation, projectRoot) {
40
+ const args = action.args;
41
+ if (!args.target || !args.destination) {
42
+ return { success: false, message: 'Move action requires target and destination', verb: 'move' };
43
+ }
44
+ try {
45
+ const filePath = path.resolve(projectRoot, notation.location.file);
46
+ const content = fs.readFileSync(filePath, 'utf-8');
47
+ const lines = content.split('\n');
48
+ const startLine = notation.location.line - 1;
49
+ const endLine = (notation.location.endLine ?? notation.location.line + notation.codeContext.length) - 1;
50
+ const searchEnd = Math.min(endLine + 10, lines.length - 1);
51
+ let moveStart = -1;
52
+ for (let i = startLine; i <= searchEnd; i++) {
53
+ if (lines[i].includes(args.target)) {
54
+ moveStart = i;
55
+ break;
56
+ }
57
+ }
58
+ if (moveStart === -1) {
59
+ return { success: false, message: `Target "${args.target}" not found in code context`, verb: 'move' };
60
+ }
61
+ const moved = lines[moveStart];
62
+ // Write to destination file
63
+ const destPath = path.resolve(projectRoot, args.destination);
64
+ const destDir = path.dirname(destPath);
65
+ fs.mkdirSync(destDir, { recursive: true });
66
+ let destContent = '';
67
+ try {
68
+ destContent = fs.readFileSync(destPath, 'utf-8');
69
+ }
70
+ catch {
71
+ // File doesn't exist yet
72
+ }
73
+ destContent = destContent ? destContent + '\n' + moved + '\n' : moved + '\n';
74
+ fs.writeFileSync(destPath, destContent, 'utf-8');
75
+ // Remove from source
76
+ lines.splice(moveStart, 1);
77
+ fs.writeFileSync(filePath, lines.join('\n'), 'utf-8');
78
+ return { success: true, message: `Moved "${args.target}" to ${args.destination}`, verb: 'move' };
79
+ }
80
+ catch (err) {
81
+ return { success: false, message: `Move failed: ${err.message}`, verb: 'move' };
82
+ }
83
+ }
@@ -1,4 +1,4 @@
1
- import type { NotationAction } from '../../types';
1
+ import type { NotationAction, Notation } from '../../types';
2
2
  import type { ActionResult } from '../action-executor';
3
- export declare function handleRemove(action: NotationAction): Promise<ActionResult>;
3
+ export declare function handleRemove(action: NotationAction, notation: Notation, projectRoot: string): Promise<ActionResult>;
4
4
  //# sourceMappingURL=remove-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove-action.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/remove-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAMhF"}
1
+ {"version":3,"file":"remove-action.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/remove-action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAc,MAAM,aAAa,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAsCzH"}
@@ -1,10 +1,74 @@
1
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.handleRemove = handleRemove;
4
- async function handleRemove(action) {
5
- return {
6
- success: true,
7
- message: `Would execute remove: ${action.raw}`,
8
- verb: 'remove',
9
- };
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ async function handleRemove(action, notation, projectRoot) {
40
+ const args = action.args;
41
+ if (!args.target) {
42
+ return { success: false, message: 'Remove action requires target', verb: 'remove' };
43
+ }
44
+ try {
45
+ const filePath = path.resolve(projectRoot, notation.location.file);
46
+ const content = fs.readFileSync(filePath, 'utf-8');
47
+ const lines = content.split('\n');
48
+ const startLine = notation.location.line - 1;
49
+ const endLine = (notation.location.endLine ?? notation.location.line + notation.codeContext.length) - 1;
50
+ const searchEnd = Math.min(endLine + 10, lines.length - 1);
51
+ let removed = false;
52
+ for (let i = startLine; i <= searchEnd; i++) {
53
+ if (lines[i].includes(args.target)) {
54
+ // If the target is the entire line content (trimmed), remove the line
55
+ if (lines[i].trim() === args.target.trim()) {
56
+ lines.splice(i, 1);
57
+ }
58
+ else {
59
+ lines[i] = lines[i].replace(args.target, '');
60
+ }
61
+ removed = true;
62
+ break;
63
+ }
64
+ }
65
+ if (!removed) {
66
+ return { success: false, message: `Target "${args.target}" not found in code context`, verb: 'remove' };
67
+ }
68
+ fs.writeFileSync(filePath, lines.join('\n'), 'utf-8');
69
+ return { success: true, message: `Removed "${args.target}"`, verb: 'remove' };
70
+ }
71
+ catch (err) {
72
+ return { success: false, message: `Remove failed: ${err.message}`, verb: 'remove' };
73
+ }
10
74
  }
@@ -1,4 +1,4 @@
1
- import type { NotationAction } from '../../types';
1
+ import type { NotationAction, Notation } from '../../types';
2
2
  import type { ActionResult } from '../action-executor';
3
- export declare function handleRename(action: NotationAction): Promise<ActionResult>;
3
+ export declare function handleRename(action: NotationAction, notation: Notation, projectRoot: string): Promise<ActionResult>;
4
4
  //# sourceMappingURL=rename-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rename-action.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/rename-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAMhF"}
1
+ {"version":3,"file":"rename-action.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/rename-action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAc,MAAM,aAAa,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAoCzH"}
@@ -1,10 +1,73 @@
1
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.handleRename = handleRename;
4
- async function handleRename(action) {
5
- return {
6
- success: true,
7
- message: `Would execute rename: ${action.raw}`,
8
- verb: 'rename',
9
- };
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ async function handleRename(action, notation, projectRoot) {
40
+ const args = action.args;
41
+ if (!args.from || !args.to) {
42
+ return { success: false, message: 'Rename action requires from and to', verb: 'rename' };
43
+ }
44
+ try {
45
+ const filePath = path.resolve(projectRoot, notation.location.file);
46
+ const content = fs.readFileSync(filePath, 'utf-8');
47
+ const lines = content.split('\n');
48
+ const startLine = notation.location.line - 1;
49
+ const endLine = (notation.location.endLine ?? notation.location.line + notation.codeContext.length) - 1;
50
+ const searchEnd = Math.min(endLine + 10, lines.length - 1);
51
+ // Word boundary regex for the identifier
52
+ const wordRegex = new RegExp(`\\b${escapeRegExp(args.from)}\\b`, 'g');
53
+ let count = 0;
54
+ for (let i = startLine; i <= searchEnd; i++) {
55
+ if (wordRegex.test(lines[i])) {
56
+ lines[i] = lines[i].replace(wordRegex, args.to);
57
+ count++;
58
+ }
59
+ wordRegex.lastIndex = 0; // Reset global regex
60
+ }
61
+ if (count === 0) {
62
+ return { success: false, message: `Identifier "${args.from}" not found in code context`, verb: 'rename' };
63
+ }
64
+ fs.writeFileSync(filePath, lines.join('\n'), 'utf-8');
65
+ return { success: true, message: `Renamed "${args.from}" to "${args.to}" (${count} occurrence(s))`, verb: 'rename' };
66
+ }
67
+ catch (err) {
68
+ return { success: false, message: `Rename failed: ${err.message}`, verb: 'rename' };
69
+ }
70
+ }
71
+ function escapeRegExp(str) {
72
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
10
73
  }
@@ -1,4 +1,4 @@
1
- import type { NotationAction } from '../../types';
1
+ import type { NotationAction, Notation } from '../../types';
2
2
  import type { ActionResult } from '../action-executor';
3
- export declare function handleReplace(action: NotationAction): Promise<ActionResult>;
3
+ export declare function handleReplace(action: NotationAction, notation: Notation, projectRoot: string): Promise<ActionResult>;
4
4
  //# sourceMappingURL=replace-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"replace-action.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/replace-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAsB,aAAa,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAMjF"}
1
+ {"version":3,"file":"replace-action.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/replace-action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAe,MAAM,aAAa,CAAA;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAsB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAkC1H"}
@@ -1,10 +1,69 @@
1
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.handleReplace = handleReplace;
4
- async function handleReplace(action) {
5
- return {
6
- success: true,
7
- message: `Would execute replace: ${action.raw}`,
8
- verb: 'replace',
9
- };
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ async function handleReplace(action, notation, projectRoot) {
40
+ const args = action.args;
41
+ if (!args.target || !args.replacement) {
42
+ return { success: false, message: 'Replace action requires target and replacement', verb: 'replace' };
43
+ }
44
+ try {
45
+ const filePath = path.resolve(projectRoot, notation.location.file);
46
+ const content = fs.readFileSync(filePath, 'utf-8');
47
+ const lines = content.split('\n');
48
+ // Search within the code context range
49
+ const startLine = notation.location.line - 1;
50
+ const endLine = (notation.location.endLine ?? notation.location.line + notation.codeContext.length) - 1;
51
+ const searchEnd = Math.min(endLine + 10, lines.length - 1); // Extend search slightly
52
+ let replaced = false;
53
+ for (let i = startLine; i <= searchEnd; i++) {
54
+ if (lines[i].includes(args.target)) {
55
+ lines[i] = lines[i].replace(args.target, args.replacement);
56
+ replaced = true;
57
+ break;
58
+ }
59
+ }
60
+ if (!replaced) {
61
+ return { success: false, message: `Target "${args.target}" not found in code context`, verb: 'replace' };
62
+ }
63
+ fs.writeFileSync(filePath, lines.join('\n'), 'utf-8');
64
+ return { success: true, message: `Replaced "${args.target}" with "${args.replacement}"`, verb: 'replace' };
65
+ }
66
+ catch (err) {
67
+ return { success: false, message: `Replace failed: ${err.message}`, verb: 'replace' };
68
+ }
10
69
  }
@@ -0,0 +1,4 @@
1
+ import type { NotationAction, Notation } from '../../types';
2
+ import type { ActionResult } from '../action-executor';
3
+ export declare function handleWrap(action: NotationAction, notation: Notation, projectRoot: string): Promise<ActionResult>;
4
+ //# sourceMappingURL=wrap-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-action.d.ts","sourceRoot":"","sources":["../../../src/executor/actions/wrap-action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAc,MAAM,aAAa,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAsB,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAgEvH"}