@askexenow/exe-os 0.9.69 → 0.9.70

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 (75) hide show
  1. package/deploy/stack-manifests/v0.9.json +96 -16
  2. package/dist/bin/agentic-ontology-backfill.js +6 -0
  3. package/dist/bin/agentic-reflection-backfill.js +6 -0
  4. package/dist/bin/agentic-semantic-label.js +6 -0
  5. package/dist/bin/backfill-conversations.js +6 -0
  6. package/dist/bin/backfill-responses.js +6 -0
  7. package/dist/bin/backfill-vectors.js +6 -0
  8. package/dist/bin/bulk-sync-postgres.js +6 -0
  9. package/dist/bin/cleanup-stale-review-tasks.js +6 -0
  10. package/dist/bin/cli.js +1257 -178
  11. package/dist/bin/exe-agent.js +6 -0
  12. package/dist/bin/exe-assign.js +6 -0
  13. package/dist/bin/exe-boot.js +6 -0
  14. package/dist/bin/exe-call.js +6 -0
  15. package/dist/bin/exe-cloud.js +6 -0
  16. package/dist/bin/exe-dispatch.js +6 -0
  17. package/dist/bin/exe-doctor.js +6 -0
  18. package/dist/bin/exe-export-behaviors.js +6 -0
  19. package/dist/bin/exe-forget.js +6 -0
  20. package/dist/bin/exe-gateway.js +151 -110
  21. package/dist/bin/exe-heartbeat.js +6 -0
  22. package/dist/bin/exe-kill.js +6 -0
  23. package/dist/bin/exe-launch-agent.js +6 -0
  24. package/dist/bin/exe-new-employee.js +6 -0
  25. package/dist/bin/exe-pending-messages.js +6 -0
  26. package/dist/bin/exe-pending-notifications.js +6 -0
  27. package/dist/bin/exe-pending-reviews.js +6 -0
  28. package/dist/bin/exe-rename.js +13 -4
  29. package/dist/bin/exe-review.js +6 -0
  30. package/dist/bin/exe-search.js +6 -0
  31. package/dist/bin/exe-session-cleanup.js +6 -0
  32. package/dist/bin/exe-start-codex.js +6 -0
  33. package/dist/bin/exe-start-opencode.js +6 -0
  34. package/dist/bin/exe-status.js +6 -0
  35. package/dist/bin/exe-team.js +6 -0
  36. package/dist/bin/git-sweep.js +6 -0
  37. package/dist/bin/graph-backfill.js +150 -110
  38. package/dist/bin/graph-export.js +6 -0
  39. package/dist/bin/intercom-check.js +6 -0
  40. package/dist/bin/registry-proxy.js +207 -0
  41. package/dist/bin/scan-tasks.js +6 -0
  42. package/dist/bin/setup.js +6 -0
  43. package/dist/bin/shard-migrate.js +6 -0
  44. package/dist/bin/stack-update.js +128 -0
  45. package/dist/gateway/index.js +151 -110
  46. package/dist/hooks/bug-report-worker.js +6 -0
  47. package/dist/hooks/codex-stop-task-finalizer.js +6 -0
  48. package/dist/hooks/commit-complete.js +6 -0
  49. package/dist/hooks/error-recall.js +6 -0
  50. package/dist/hooks/ingest.js +6 -0
  51. package/dist/hooks/instructions-loaded.js +6 -0
  52. package/dist/hooks/notification.js +6 -0
  53. package/dist/hooks/post-compact.js +6 -0
  54. package/dist/hooks/post-tool-combined.js +6 -0
  55. package/dist/hooks/pre-compact.js +6 -0
  56. package/dist/hooks/pre-tool-use.js +6 -0
  57. package/dist/hooks/prompt-submit.js +6 -0
  58. package/dist/hooks/session-end.js +6 -0
  59. package/dist/hooks/session-start.js +6 -0
  60. package/dist/hooks/stop.js +6 -0
  61. package/dist/hooks/subagent-stop.js +6 -0
  62. package/dist/hooks/summary-worker.js +6 -0
  63. package/dist/index.js +151 -110
  64. package/dist/lib/employee-templates.js +6 -0
  65. package/dist/lib/exe-daemon.js +382 -234
  66. package/dist/lib/hybrid-search.js +6 -0
  67. package/dist/lib/registry-proxy.js +162 -0
  68. package/dist/lib/schedules.js +6 -0
  69. package/dist/lib/store.js +6 -0
  70. package/dist/mcp/server.js +318 -222
  71. package/dist/runtime/index.js +6 -0
  72. package/dist/tui/App.js +6 -0
  73. package/package.json +3 -2
  74. package/stack.release.json +6 -4
  75. package/stack.release.schema.json +89 -18
@@ -4565,6 +4565,12 @@ var init_platform_procedures = __esm({
4565
4565
  priority: "p0",
4566
4566
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
4567
4567
  },
4568
+ {
4569
+ title: "Code context first for repository orientation",
4570
+ domain: "workflow",
4571
+ priority: "p1",
4572
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4573
+ },
4568
4574
  {
4569
4575
  title: "Commit discipline \u2014 never leave verified work floating",
4570
4576
  domain: "workflow",
@@ -4301,6 +4301,12 @@ var init_platform_procedures = __esm({
4301
4301
  priority: "p0",
4302
4302
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
4303
4303
  },
4304
+ {
4305
+ title: "Code context first for repository orientation",
4306
+ domain: "workflow",
4307
+ priority: "p1",
4308
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4309
+ },
4304
4310
  {
4305
4311
  title: "Commit discipline \u2014 never leave verified work floating",
4306
4312
  domain: "workflow",
@@ -7890,6 +7890,12 @@ var init_platform_procedures = __esm({
7890
7890
  priority: "p0",
7891
7891
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
7892
7892
  },
7893
+ {
7894
+ title: "Code context first for repository orientation",
7895
+ domain: "workflow",
7896
+ priority: "p1",
7897
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
7898
+ },
7893
7899
  {
7894
7900
  title: "Commit discipline \u2014 never leave verified work floating",
7895
7901
  domain: "workflow",
@@ -5036,6 +5036,12 @@ var init_platform_procedures = __esm({
5036
5036
  priority: "p0",
5037
5037
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
5038
5038
  },
5039
+ {
5040
+ title: "Code context first for repository orientation",
5041
+ domain: "workflow",
5042
+ priority: "p1",
5043
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
5044
+ },
5039
5045
  {
5040
5046
  title: "Commit discipline \u2014 never leave verified work floating",
5041
5047
  domain: "workflow",
@@ -4469,6 +4469,12 @@ var init_platform_procedures = __esm({
4469
4469
  priority: "p0",
4470
4470
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
4471
4471
  },
4472
+ {
4473
+ title: "Code context first for repository orientation",
4474
+ domain: "workflow",
4475
+ priority: "p1",
4476
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4477
+ },
4472
4478
  {
4473
4479
  title: "Commit discipline \u2014 never leave verified work floating",
4474
4480
  domain: "workflow",
@@ -8099,6 +8099,12 @@ var init_platform_procedures = __esm({
8099
8099
  priority: "p0",
8100
8100
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
8101
8101
  },
8102
+ {
8103
+ title: "Code context first for repository orientation",
8104
+ domain: "workflow",
8105
+ priority: "p1",
8106
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
8107
+ },
8102
8108
  {
8103
8109
  title: "Commit discipline \u2014 never leave verified work floating",
8104
8110
  domain: "workflow",
@@ -4535,6 +4535,12 @@ var init_platform_procedures = __esm({
4535
4535
  priority: "p0",
4536
4536
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
4537
4537
  },
4538
+ {
4539
+ title: "Code context first for repository orientation",
4540
+ domain: "workflow",
4541
+ priority: "p1",
4542
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4543
+ },
4538
4544
  {
4539
4545
  title: "Commit discipline \u2014 never leave verified work floating",
4540
4546
  domain: "workflow",
@@ -4600,6 +4600,12 @@ var init_platform_procedures = __esm({
4600
4600
  priority: "p0",
4601
4601
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
4602
4602
  },
4603
+ {
4604
+ title: "Code context first for repository orientation",
4605
+ domain: "workflow",
4606
+ priority: "p1",
4607
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4608
+ },
4603
4609
  {
4604
4610
  title: "Commit discipline \u2014 never leave verified work floating",
4605
4611
  domain: "workflow",
@@ -4572,6 +4572,12 @@ var init_platform_procedures = __esm({
4572
4572
  priority: "p0",
4573
4573
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
4574
4574
  },
4575
+ {
4576
+ title: "Code context first for repository orientation",
4577
+ domain: "workflow",
4578
+ priority: "p1",
4579
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4580
+ },
4575
4581
  {
4576
4582
  title: "Commit discipline \u2014 never leave verified work floating",
4577
4583
  domain: "workflow",
@@ -4171,6 +4171,12 @@ var init_platform_procedures = __esm({
4171
4171
  priority: "p0",
4172
4172
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
4173
4173
  },
4174
+ {
4175
+ title: "Code context first for repository orientation",
4176
+ domain: "workflow",
4177
+ priority: "p1",
4178
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4179
+ },
4174
4180
  {
4175
4181
  title: "Commit discipline \u2014 never leave verified work floating",
4176
4182
  domain: "workflow",
package/dist/index.js CHANGED
@@ -8188,6 +8188,12 @@ var init_platform_procedures = __esm({
8188
8188
  priority: "p0",
8189
8189
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
8190
8190
  },
8191
+ {
8192
+ title: "Code context first for repository orientation",
8193
+ domain: "workflow",
8194
+ priority: "p1",
8195
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
8196
+ },
8191
8197
  {
8192
8198
  title: "Commit discipline \u2014 never leave verified work floating",
8193
8199
  domain: "workflow",
@@ -10149,13 +10155,25 @@ var init_wiki_client = __esm({
10149
10155
 
10150
10156
  // src/lib/code-chunker.ts
10151
10157
  import ts from "typescript";
10158
+ function languageForFile(filePath) {
10159
+ const base = filePath.split(/[\\/]/).pop()?.toLowerCase() ?? "";
10160
+ if (["dockerfile", "makefile", "rakefile", "gemfile"].includes(base)) return base;
10161
+ const ext = base.includes(".") ? base.split(".").pop() : void 0;
10162
+ return ext ? LANGUAGE_BY_EXTENSION[ext] : void 0;
10163
+ }
10152
10164
  function chunkSourceFile(source, fileName = "file.ts") {
10165
+ const language = languageForFile(fileName);
10166
+ if (language === "typescript" || language === "javascript") {
10167
+ return chunkTypeScriptLike(source, fileName);
10168
+ }
10169
+ return chunkGenericSource(source, fileName, language);
10170
+ }
10171
+ function chunkTypeScriptLike(source, fileName) {
10153
10172
  const sourceFile = ts.createSourceFile(
10154
10173
  fileName,
10155
10174
  source,
10156
10175
  ts.ScriptTarget.Latest,
10157
10176
  true,
10158
- // setParentNodes
10159
10177
  fileName.endsWith(".tsx") || fileName.endsWith(".jsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS
10160
10178
  );
10161
10179
  const chunks = [];
@@ -10177,153 +10195,176 @@ function chunkSourceFile(source, fileName = "file.ts") {
10177
10195
  if (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node)) {
10178
10196
  return node.name?.getText(sourceFile) ?? "(anonymous)";
10179
10197
  }
10180
- if (ts.isClassDeclaration(node)) {
10181
- return node.name?.getText(sourceFile) ?? "(anonymous class)";
10182
- }
10183
- if (ts.isInterfaceDeclaration(node)) {
10184
- return node.name.getText(sourceFile);
10185
- }
10186
- if (ts.isTypeAliasDeclaration(node)) {
10187
- return node.name.getText(sourceFile);
10188
- }
10189
- if (ts.isEnumDeclaration(node)) {
10190
- return node.name.getText(sourceFile);
10191
- }
10192
- if (ts.isVariableStatement(node)) {
10193
- const decls = node.declarationList.declarations;
10194
- return decls.map((d) => d.name.getText(sourceFile)).join(", ");
10195
- }
10196
- if (ts.isExportAssignment(node)) {
10197
- return "default export";
10198
- }
10198
+ if (ts.isClassDeclaration(node)) return node.name?.getText(sourceFile) ?? "(anonymous class)";
10199
+ if (ts.isInterfaceDeclaration(node)) return node.name.getText(sourceFile);
10200
+ if (ts.isTypeAliasDeclaration(node)) return node.name.getText(sourceFile);
10201
+ if (ts.isEnumDeclaration(node)) return node.name.getText(sourceFile);
10202
+ if (ts.isVariableStatement(node)) return node.declarationList.declarations.map((d) => d.name.getText(sourceFile)).join(", ");
10203
+ if (ts.isExportAssignment(node)) return "default export";
10199
10204
  return "(unknown)";
10200
10205
  }
10201
10206
  function visitTopLevel(node) {
10202
10207
  if (ts.isImportDeclaration(node)) {
10203
- importLines.push({
10204
- start: getLineNumber(node.getStart(sourceFile)),
10205
- end: getLineNumber(node.getEnd())
10206
- });
10208
+ importLines.push({ start: getLineNumber(node.getStart(sourceFile)), end: getLineNumber(node.getEnd()) });
10207
10209
  return;
10208
10210
  }
10209
10211
  if (ts.isFunctionDeclaration(node)) {
10210
- chunks.push({
10211
- kind: "function",
10212
- name: getName(node),
10213
- text: getNodeText(node),
10214
- startLine: getLineNumber(node.getStart(sourceFile)),
10215
- endLine: getLineNumber(node.getEnd()),
10216
- comment: getLeadingComment(node)
10217
- });
10212
+ chunks.push({ kind: "function", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
10218
10213
  return;
10219
10214
  }
10220
10215
  if (ts.isClassDeclaration(node)) {
10221
- chunks.push({
10222
- kind: "class",
10223
- name: getName(node),
10224
- text: getNodeText(node),
10225
- startLine: getLineNumber(node.getStart(sourceFile)),
10226
- endLine: getLineNumber(node.getEnd()),
10227
- comment: getLeadingComment(node)
10228
- });
10216
+ chunks.push({ kind: "class", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
10229
10217
  return;
10230
10218
  }
10231
- if (ts.isInterfaceDeclaration(node)) {
10232
- chunks.push({
10233
- kind: "type",
10234
- name: getName(node),
10235
- text: getNodeText(node),
10236
- startLine: getLineNumber(node.getStart(sourceFile)),
10237
- endLine: getLineNumber(node.getEnd()),
10238
- comment: getLeadingComment(node)
10239
- });
10240
- return;
10241
- }
10242
- if (ts.isTypeAliasDeclaration(node)) {
10243
- chunks.push({
10244
- kind: "type",
10245
- name: getName(node),
10246
- text: getNodeText(node),
10247
- startLine: getLineNumber(node.getStart(sourceFile)),
10248
- endLine: getLineNumber(node.getEnd()),
10249
- comment: getLeadingComment(node)
10250
- });
10251
- return;
10252
- }
10253
- if (ts.isEnumDeclaration(node)) {
10254
- chunks.push({
10255
- kind: "type",
10256
- name: getName(node),
10257
- text: getNodeText(node),
10258
- startLine: getLineNumber(node.getStart(sourceFile)),
10259
- endLine: getLineNumber(node.getEnd()),
10260
- comment: getLeadingComment(node)
10261
- });
10219
+ if (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isEnumDeclaration(node)) {
10220
+ chunks.push({ kind: "type", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
10262
10221
  return;
10263
10222
  }
10264
10223
  if (ts.isVariableStatement(node)) {
10265
- const decls = node.declarationList.declarations;
10266
- const isFnLike = decls.some(
10267
- (d) => d.initializer && (ts.isArrowFunction(d.initializer) || ts.isFunctionExpression(d.initializer))
10268
- );
10269
- chunks.push({
10270
- kind: isFnLike ? "function" : "variable",
10271
- name: getName(node),
10272
- text: getNodeText(node),
10273
- startLine: getLineNumber(node.getStart(sourceFile)),
10274
- endLine: getLineNumber(node.getEnd()),
10275
- comment: getLeadingComment(node)
10276
- });
10224
+ const isFnLike = node.declarationList.declarations.some((d) => d.initializer && (ts.isArrowFunction(d.initializer) || ts.isFunctionExpression(d.initializer)));
10225
+ chunks.push({ kind: isFnLike ? "function" : "variable", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
10277
10226
  return;
10278
10227
  }
10279
10228
  if (ts.isExportAssignment(node)) {
10280
- chunks.push({
10281
- kind: "export",
10282
- name: "default export",
10283
- text: getNodeText(node),
10284
- startLine: getLineNumber(node.getStart(sourceFile)),
10285
- endLine: getLineNumber(node.getEnd()),
10286
- comment: getLeadingComment(node)
10287
- });
10229
+ chunks.push({ kind: "export", name: "default export", text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
10288
10230
  return;
10289
10231
  }
10290
10232
  if (ts.isExpressionStatement(node)) {
10291
10233
  const text = getNodeText(node);
10292
- if (text.length > 10) {
10293
- chunks.push({
10294
- kind: "other",
10295
- name: text.slice(0, 40).replace(/\n/g, " "),
10296
- text,
10297
- startLine: getLineNumber(node.getStart(sourceFile)),
10298
- endLine: getLineNumber(node.getEnd())
10299
- });
10300
- }
10301
- return;
10234
+ if (text.length > 10) chunks.push({ kind: "other", name: text.slice(0, 40).replace(/\n/g, " "), text, startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()) });
10302
10235
  }
10303
10236
  }
10304
10237
  sourceFile.statements.forEach(visitTopLevel);
10305
10238
  if (importLines.length > 0) {
10306
10239
  const startLine = importLines[0].start;
10307
10240
  const endLine = importLines[importLines.length - 1].end;
10308
- const importText = lines.slice(startLine - 1, endLine).join("\n");
10309
- chunks.unshift({
10310
- kind: "import",
10311
- name: `${importLines.length} imports`,
10312
- text: importText,
10313
- startLine,
10241
+ chunks.unshift({ kind: "import", name: `${importLines.length} imports`, text: lines.slice(startLine - 1, endLine).join("\n"), startLine, endLine });
10242
+ }
10243
+ chunks.sort((a, b) => a.startLine - b.startLine);
10244
+ return chunks.length > 0 ? chunks : chunkByWindows(source, 80);
10245
+ }
10246
+ function chunkGenericSource(source, _fileName, language) {
10247
+ const lines = source.split("\n");
10248
+ if (source.trim().length === 0) return [];
10249
+ if (language && TEXT_LIKE_LANGUAGES.has(language)) return chunkTextLike(lines, language);
10250
+ const chunks = [];
10251
+ const patterns = [
10252
+ { kind: "function", regex: /^\s*(?:async\s+)?def\s+([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
10253
+ { kind: "class", regex: /^\s*class\s+([A-Za-z_][\w]*)\b/, name: (m) => m[1] },
10254
+ { kind: "function", regex: /^\s*(?:pub\s+)?fn\s+([A-Za-z_][\w]*)\s*[<(]/, name: (m) => m[1] },
10255
+ { kind: "class", regex: /^\s*(?:pub\s+)?(?:struct|enum|trait)\s+([A-Za-z_][\w]*)\b/, name: (m) => m[1] },
10256
+ { kind: "function", regex: /^\s*func\s+(?:\([^)]*\)\s*)?([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
10257
+ { kind: "function", regex: /^\s*(?:public|private|protected|static|final|suspend|fun|override|open|internal|export|async|func|function|subroutine)\s+.*?([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
10258
+ { kind: "function", regex: /^\s*function\s+([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
10259
+ { kind: "type", regex: /^\s*(?:interface|type|enum|record|data\s+class|case\s+class|contract|library)\s+([A-Za-z_][\w]*)\b/, name: (m) => m[1] },
10260
+ { kind: "section", regex: /^\s{0,3}#{1,6}\s+(.+)$/, name: (m) => m[1].trim() }
10261
+ ];
10262
+ const starts = [];
10263
+ for (let i = 0; i < lines.length; i++) {
10264
+ const line = lines[i];
10265
+ for (const pattern of patterns) {
10266
+ const match = line.match(pattern.regex);
10267
+ if (match) {
10268
+ starts.push({ line: i + 1, kind: pattern.kind, name: pattern.name(match) });
10269
+ break;
10270
+ }
10271
+ }
10272
+ }
10273
+ if (starts.length === 0) return chunkByWindows(source, 80);
10274
+ for (let i = 0; i < starts.length; i++) {
10275
+ const start = starts[i];
10276
+ const next = starts[i + 1]?.line ?? lines.length + 1;
10277
+ const endLine = Math.max(start.line, next - 1);
10278
+ chunks.push({
10279
+ kind: start.kind,
10280
+ name: start.name,
10281
+ text: lines.slice(start.line - 1, endLine).join("\n"),
10282
+ startLine: start.line,
10314
10283
  endLine
10315
10284
  });
10316
10285
  }
10317
- chunks.sort((a, b) => a.startLine - b.startLine);
10286
+ return chunks;
10287
+ }
10288
+ function chunkTextLike(lines, language) {
10289
+ if (language === "markdown" || language === "mdx") {
10290
+ const starts = lines.map((line, i) => ({ line, i })).filter(({ line }) => /^\s{0,3}#{1,6}\s+/.test(line));
10291
+ if (starts.length > 0) {
10292
+ return starts.map((start, idx) => {
10293
+ const end = starts[idx + 1]?.i ?? lines.length;
10294
+ const title = start.line.replace(/^\s{0,3}#{1,6}\s+/, "").trim();
10295
+ return { kind: "section", name: title, text: lines.slice(start.i, end).join("\n"), startLine: start.i + 1, endLine: end };
10296
+ });
10297
+ }
10298
+ }
10299
+ return chunkByWindows(lines.join("\n"), 80);
10300
+ }
10301
+ function chunkByWindows(source, windowLines) {
10302
+ const lines = source.split("\n");
10303
+ const chunks = [];
10304
+ for (let i = 0; i < lines.length; i += windowLines) {
10305
+ const end = Math.min(lines.length, i + windowLines);
10306
+ const text = lines.slice(i, end).join("\n");
10307
+ if (text.trim()) chunks.push({ kind: "other", name: `lines ${i + 1}-${end}`, text, startLine: i + 1, endLine: end });
10308
+ }
10318
10309
  return chunks;
10319
10310
  }
10320
10311
  function isChunkable(filePath) {
10321
- const ext = filePath.split(".").pop()?.toLowerCase();
10322
- return ext === "ts" || ext === "tsx" || ext === "js" || ext === "jsx";
10312
+ return Boolean(languageForFile(filePath));
10323
10313
  }
10314
+ var LANGUAGE_BY_EXTENSION, TEXT_LIKE_LANGUAGES;
10324
10315
  var init_code_chunker = __esm({
10325
10316
  "src/lib/code-chunker.ts"() {
10326
10317
  "use strict";
10318
+ LANGUAGE_BY_EXTENSION = {
10319
+ c: "c",
10320
+ cc: "cpp",
10321
+ cpp: "cpp",
10322
+ cxx: "cpp",
10323
+ h: "c",
10324
+ hh: "cpp",
10325
+ hpp: "cpp",
10326
+ cs: "csharp",
10327
+ css: "css",
10328
+ scss: "scss",
10329
+ f: "fortran",
10330
+ f90: "fortran",
10331
+ f95: "fortran",
10332
+ go: "go",
10333
+ html: "html",
10334
+ htm: "html",
10335
+ java: "java",
10336
+ js: "javascript",
10337
+ jsx: "javascript",
10338
+ json: "json",
10339
+ kt: "kotlin",
10340
+ kts: "kotlin",
10341
+ lua: "lua",
10342
+ md: "markdown",
10343
+ mdx: "mdx",
10344
+ pas: "pascal",
10345
+ php: "php",
10346
+ py: "python",
10347
+ r: "r",
10348
+ rb: "ruby",
10349
+ rs: "rust",
10350
+ scala: "scala",
10351
+ sc: "scala",
10352
+ sol: "solidity",
10353
+ sql: "sql",
10354
+ svelte: "svelte",
10355
+ swift: "swift",
10356
+ toml: "toml",
10357
+ ts: "typescript",
10358
+ tsx: "typescript",
10359
+ vue: "vue",
10360
+ xml: "xml",
10361
+ yaml: "yaml",
10362
+ yml: "yaml",
10363
+ sh: "shell",
10364
+ bash: "shell",
10365
+ zsh: "shell"
10366
+ };
10367
+ TEXT_LIKE_LANGUAGES = /* @__PURE__ */ new Set(["json", "markdown", "mdx", "toml", "yaml", "xml", "html", "css", "scss", "sql"]);
10327
10368
  }
10328
10369
  });
10329
10370
 
@@ -237,6 +237,12 @@ var PLATFORM_PROCEDURES = [
237
237
  priority: "p0",
238
238
  content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
239
239
  },
240
+ {
241
+ title: "Code context first for repository orientation",
242
+ domain: "workflow",
243
+ priority: "p1",
244
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
245
+ },
240
246
  {
241
247
  title: "Commit discipline \u2014 never leave verified work floating",
242
248
  domain: "workflow",