oxe-cc 0.7.1 → 0.9.1

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 (156) hide show
  1. package/.cursor/commands/oxe-ask.md +34 -0
  2. package/.cursor/commands/oxe-capabilities.md +34 -0
  3. package/.cursor/commands/oxe-checkpoint.md +34 -0
  4. package/.cursor/commands/oxe-compact.md +33 -0
  5. package/.cursor/commands/oxe-dashboard.md +34 -0
  6. package/.cursor/commands/oxe-debug.md +34 -0
  7. package/.cursor/commands/oxe-discuss.md +34 -0
  8. package/.cursor/commands/oxe-execute.md +34 -0
  9. package/.cursor/commands/oxe-forensics.md +34 -0
  10. package/.cursor/commands/oxe-help.md +33 -0
  11. package/.cursor/commands/oxe-loop.md +34 -0
  12. package/.cursor/commands/oxe-milestone.md +34 -0
  13. package/.cursor/commands/oxe-next.md +33 -0
  14. package/.cursor/commands/oxe-obs.md +34 -0
  15. package/.cursor/commands/oxe-plan-agent.md +33 -0
  16. package/.cursor/commands/oxe-plan.md +34 -0
  17. package/.cursor/commands/oxe-project.md +34 -0
  18. package/.cursor/commands/oxe-quick.md +34 -0
  19. package/.cursor/commands/oxe-research.md +34 -0
  20. package/.cursor/commands/oxe-retro.md +34 -0
  21. package/.cursor/commands/oxe-review-pr.md +34 -0
  22. package/.cursor/commands/oxe-route.md +34 -0
  23. package/.cursor/commands/oxe-scan.md +34 -0
  24. package/.cursor/commands/oxe-security.md +34 -0
  25. package/.cursor/commands/oxe-session.md +34 -0
  26. package/.cursor/commands/oxe-skill.md +45 -0
  27. package/.cursor/commands/oxe-spec.md +34 -0
  28. package/.cursor/commands/oxe-ui-review.md +34 -0
  29. package/.cursor/commands/oxe-ui-spec.md +34 -0
  30. package/.cursor/commands/oxe-update.md +33 -0
  31. package/.cursor/commands/oxe-validate-gaps.md +34 -0
  32. package/.cursor/commands/oxe-verify.md +34 -0
  33. package/.cursor/commands/oxe-workstream.md +34 -0
  34. package/.cursor/commands/oxe.md +38 -2
  35. package/.github/copilot-instructions.md +8 -5
  36. package/.github/prompts/oxe-ask.prompt.md +33 -0
  37. package/.github/prompts/oxe-capabilities.prompt.md +33 -0
  38. package/.github/prompts/oxe-checkpoint.prompt.md +45 -12
  39. package/.github/prompts/oxe-compact.prompt.md +44 -11
  40. package/.github/prompts/oxe-dashboard.prompt.md +33 -0
  41. package/.github/prompts/oxe-debug.prompt.md +45 -12
  42. package/.github/prompts/oxe-discuss.prompt.md +33 -0
  43. package/.github/prompts/oxe-execute.prompt.md +45 -12
  44. package/.github/prompts/oxe-forensics.prompt.md +45 -12
  45. package/.github/prompts/oxe-help.prompt.md +42 -9
  46. package/.github/prompts/oxe-loop.prompt.md +45 -12
  47. package/.github/prompts/oxe-milestone.prompt.md +45 -12
  48. package/.github/prompts/oxe-next.prompt.md +42 -9
  49. package/.github/prompts/oxe-obs.prompt.md +45 -12
  50. package/.github/prompts/oxe-plan-agent.prompt.md +43 -10
  51. package/.github/prompts/oxe-plan.prompt.md +45 -12
  52. package/.github/prompts/oxe-project.prompt.md +45 -12
  53. package/.github/prompts/oxe-quick.prompt.md +45 -12
  54. package/.github/prompts/oxe-research.prompt.md +45 -12
  55. package/.github/prompts/oxe-retro.prompt.md +45 -12
  56. package/.github/prompts/oxe-review-pr.prompt.md +45 -12
  57. package/.github/prompts/oxe-route.prompt.md +45 -12
  58. package/.github/prompts/oxe-scan.prompt.md +45 -12
  59. package/.github/prompts/oxe-security.prompt.md +45 -12
  60. package/.github/prompts/oxe-session.prompt.md +33 -0
  61. package/.github/prompts/oxe-skill.prompt.md +45 -0
  62. package/.github/prompts/oxe-spec.prompt.md +45 -12
  63. package/.github/prompts/oxe-ui-review.prompt.md +45 -12
  64. package/.github/prompts/oxe-ui-spec.prompt.md +45 -12
  65. package/.github/prompts/oxe-update.prompt.md +44 -11
  66. package/.github/prompts/oxe-validate-gaps.prompt.md +45 -12
  67. package/.github/prompts/oxe-verify.prompt.md +45 -12
  68. package/.github/prompts/oxe-workstream.prompt.md +45 -12
  69. package/.github/prompts/oxe.prompt.md +45 -12
  70. package/AGENTS.md +6 -4
  71. package/CHANGELOG.md +45 -0
  72. package/README.md +38 -8
  73. package/bin/lib/oxe-agent-install.cjs +69 -55
  74. package/bin/lib/oxe-context-engine.cjs +866 -0
  75. package/bin/lib/oxe-dashboard.cjs +605 -588
  76. package/bin/lib/oxe-operational.cjs +105 -0
  77. package/bin/lib/oxe-plugins.cjs +115 -0
  78. package/bin/lib/oxe-project-health.cjs +1139 -666
  79. package/bin/lib/oxe-runtime-semantics.cjs +459 -0
  80. package/bin/lib/oxe-security.cjs +64 -0
  81. package/bin/oxe-cc.js +615 -46
  82. package/commands/oxe/ask.md +33 -0
  83. package/commands/oxe/capabilities.md +33 -0
  84. package/commands/oxe/checkpoint.md +49 -16
  85. package/commands/oxe/compact.md +43 -10
  86. package/commands/oxe/dashboard.md +33 -0
  87. package/commands/oxe/debug.md +49 -16
  88. package/commands/oxe/discuss.md +33 -0
  89. package/commands/oxe/execute.md +49 -16
  90. package/commands/oxe/forensics.md +49 -16
  91. package/commands/oxe/help.md +44 -11
  92. package/commands/oxe/loop.md +50 -17
  93. package/commands/oxe/milestone.md +49 -16
  94. package/commands/oxe/next.md +45 -12
  95. package/commands/oxe/obs.md +49 -16
  96. package/commands/oxe/oxe.md +49 -16
  97. package/commands/oxe/plan-agent.md +48 -15
  98. package/commands/oxe/plan.md +48 -15
  99. package/commands/oxe/project.md +49 -16
  100. package/commands/oxe/quick.md +49 -16
  101. package/commands/oxe/research.md +49 -16
  102. package/commands/oxe/retro.md +49 -16
  103. package/commands/oxe/review-pr.md +49 -16
  104. package/commands/oxe/route.md +44 -11
  105. package/commands/oxe/scan.md +49 -16
  106. package/commands/oxe/security.md +49 -16
  107. package/commands/oxe/session.md +33 -0
  108. package/commands/oxe/skill.md +49 -0
  109. package/commands/oxe/spec.md +47 -14
  110. package/commands/oxe/ui-review.md +49 -16
  111. package/commands/oxe/ui-spec.md +49 -16
  112. package/commands/oxe/update.md +49 -16
  113. package/commands/oxe/validate-gaps.md +49 -16
  114. package/commands/oxe/verify.md +48 -15
  115. package/commands/oxe/workstream.md +49 -16
  116. package/lib/sdk/index.cjs +140 -7
  117. package/lib/sdk/index.d.ts +266 -1
  118. package/oxe/templates/HYPOTHESES.template.md +33 -0
  119. package/oxe/templates/PLAN.template.md +53 -22
  120. package/oxe/templates/SESSION.template.md +2 -0
  121. package/oxe/templates/SKILL.template.md +26 -0
  122. package/oxe/templates/WORKFLOW_AUTHORING.md +18 -2
  123. package/oxe/templates/config.template.json +16 -14
  124. package/oxe/workflows/ask.md +28 -7
  125. package/oxe/workflows/capabilities.md +2 -0
  126. package/oxe/workflows/dashboard.md +12 -2
  127. package/oxe/workflows/debug.md +9 -4
  128. package/oxe/workflows/discuss.md +12 -6
  129. package/oxe/workflows/execute.md +34 -12
  130. package/oxe/workflows/forensics.md +14 -9
  131. package/oxe/workflows/help.md +20 -9
  132. package/oxe/workflows/loop.md +13 -7
  133. package/oxe/workflows/next.md +6 -4
  134. package/oxe/workflows/plan-agent.md +3 -2
  135. package/oxe/workflows/plan.md +26 -3
  136. package/oxe/workflows/quick.md +10 -3
  137. package/oxe/workflows/references/reasoning-discovery.md +28 -0
  138. package/oxe/workflows/references/reasoning-execution.md +29 -0
  139. package/oxe/workflows/references/reasoning-planning.md +32 -0
  140. package/oxe/workflows/references/reasoning-review.md +29 -0
  141. package/oxe/workflows/references/reasoning-status.md +24 -0
  142. package/oxe/workflows/references/workflow-runtime-contracts.json +879 -0
  143. package/oxe/workflows/research.md +8 -2
  144. package/oxe/workflows/retro.md +7 -2
  145. package/oxe/workflows/review-pr.md +12 -8
  146. package/oxe/workflows/route.md +16 -13
  147. package/oxe/workflows/security.md +3 -2
  148. package/oxe/workflows/session.md +44 -0
  149. package/oxe/workflows/skill.md +44 -0
  150. package/oxe/workflows/spec.md +21 -18
  151. package/oxe/workflows/ui-review.md +13 -7
  152. package/oxe/workflows/update.md +3 -1
  153. package/oxe/workflows/validate-gaps.md +12 -6
  154. package/oxe/workflows/verify-audit.md +73 -0
  155. package/oxe/workflows/verify.md +40 -16
  156. package/package.json +84 -83
@@ -66,6 +66,40 @@ export interface AzureHealthContext {
66
66
  warnings: string[];
67
67
  }
68
68
 
69
+ export type CopilotPromptSource = 'workspace' | 'legacy_global' | 'missing';
70
+
71
+ export interface CopilotWorkspaceIntegration {
72
+ root: string;
73
+ promptsDir: string;
74
+ instructions: string;
75
+ manifest: string;
76
+ promptFiles: string[];
77
+ hasInstructions: boolean;
78
+ hasOxeBlock: boolean;
79
+ }
80
+
81
+ export interface CopilotLegacyIntegration {
82
+ root: string;
83
+ promptsDir: string;
84
+ instructions: string;
85
+ promptFiles: string[];
86
+ hasInstructions: boolean;
87
+ hasOxeBlock: boolean;
88
+ hasOtherManagedBlocks: boolean;
89
+ detected: boolean;
90
+ }
91
+
92
+ export interface CopilotIntegrationReport {
93
+ status: 'healthy' | 'warning' | 'broken' | 'not_installed';
94
+ detected: boolean;
95
+ target: 'workspace';
96
+ promptSource: CopilotPromptSource;
97
+ workspace: CopilotWorkspaceIntegration;
98
+ legacy: CopilotLegacyIntegration;
99
+ manifest: Record<string, unknown> | null;
100
+ warnings: string[];
101
+ }
102
+
69
103
  /** Relatório retornado por `health.buildHealthReport` e incluído em `runDoctorChecks`.healthReport. */
70
104
  export interface OxeHealthReport {
71
105
  configPath: string | null;
@@ -80,12 +114,32 @@ export interface OxeHealthReport {
80
114
  retroDate: Date | null;
81
115
  staleLessons: HealthStaleInfo;
82
116
  phaseWarn: string[];
117
+ runtimeWarn?: string[];
118
+ reviewWarn?: string[];
119
+ capabilityWarn?: string[];
120
+ investigationWarn?: string[];
121
+ sessionWarn?: string[];
122
+ installWarn?: string[];
123
+ copilotWarn?: string[];
124
+ copilot?: CopilotIntegrationReport | null;
83
125
  summaryGapWarn: string | null;
84
126
  specWarn: string[];
85
127
  planWarn: string[];
128
+ planSelfEvaluation?: Record<string, unknown> | null;
129
+ planReviewStatus?: string | null;
130
+ activeRun?: Record<string, unknown> | null;
131
+ eventsSummary?: Record<string, unknown> | null;
132
+ memoryLayers?: Record<string, unknown> | null;
86
133
  next: OxeNextSuggestion;
87
134
  azureActive?: boolean;
88
135
  azure?: AzureHealthContext | null;
136
+ contextWarn?: string[];
137
+ semanticsWarn?: string[];
138
+ contextPacks?: Record<string, ContextPackSummary>;
139
+ contextQuality?: ContextQualitySummary;
140
+ semanticsDrift?: SemanticsDriftSummary;
141
+ packFreshness?: Record<string, PackFreshness>;
142
+ activeSummaryRefs?: { project: string | null; session: string | null; phase: string | null };
89
143
  scanFocusGlobs?: unknown;
90
144
  scanIgnoreGlobs?: unknown;
91
145
  }
@@ -128,6 +182,49 @@ export interface ParsedTask {
128
182
  meta: Record<string, unknown> | null;
129
183
  }
130
184
 
185
+ export type ContextPackMode = 'standard' | 'auditor';
186
+
187
+ export interface LessonOutcome {
188
+ cycle: string;
189
+ verify_status: string;
190
+ saved_hours?: number;
191
+ failure_condition?: string;
192
+ }
193
+
194
+ export interface LessonMetric {
195
+ id: string;
196
+ rule: string;
197
+ type: string;
198
+ applied_cycles: string[];
199
+ outcomes: LessonOutcome[];
200
+ success_rate: number;
201
+ status: 'active' | 'deprecated' | 'conditional';
202
+ deprecation_threshold: number;
203
+ }
204
+
205
+ export interface ConfidenceDimension {
206
+ name: string;
207
+ score: number;
208
+ weight: number;
209
+ note: string;
210
+ }
211
+
212
+ export interface ConfidenceVector {
213
+ cycle: string | null;
214
+ generated_at: string | null;
215
+ dimensions: ConfidenceDimension[];
216
+ global: { score: number; gate: string };
217
+ }
218
+
219
+ export interface CriticalHypothesis {
220
+ id: string;
221
+ condition: string;
222
+ validation: string;
223
+ on_failure: string;
224
+ checkpoint: string | null;
225
+ status: 'pending' | 'validated' | 'refuted' | 'skipped';
226
+ }
227
+
131
228
  export interface ParsedPlan {
132
229
  tasks: ParsedTask[];
133
230
  waves: Record<number, string[]>;
@@ -189,6 +286,110 @@ export interface PlanPathsResult {
189
286
  issues: Array<{ path: string; reason: string }>;
190
287
  }
191
288
 
289
+ export interface OxePermissionRule {
290
+ pattern: string;
291
+ action: 'allow' | 'deny' | 'ask';
292
+ scope?: 'execute' | 'apply' | 'all';
293
+ }
294
+
295
+ export interface PermissionCheckResult {
296
+ denied: string[];
297
+ needsApproval: string[];
298
+ allowed: string[];
299
+ }
300
+
301
+ export interface ReplayReport {
302
+ events: Array<Record<string, unknown>>;
303
+ totalEvents: number;
304
+ duration_ms: number | null;
305
+ runId: string | null;
306
+ waveIds: number[];
307
+ taskSequence: string[];
308
+ checkpointSequence: string[];
309
+ failureEvents: Array<Record<string, unknown>>;
310
+ _reportPath?: string;
311
+ }
312
+
313
+ export interface ContextArtifactSelection {
314
+ alias: string;
315
+ path: string | null;
316
+ exists: boolean;
317
+ required: boolean;
318
+ using_fallback: boolean;
319
+ scope: string;
320
+ summary: string;
321
+ }
322
+
323
+ export interface ContextGap {
324
+ alias: string;
325
+ severity: 'critical' | 'warning';
326
+ reason: string;
327
+ }
328
+
329
+ export interface ContextConflict {
330
+ alias: string;
331
+ reason: string;
332
+ primary_path: string | null;
333
+ fallback_path: string | null;
334
+ }
335
+
336
+ export interface PackFreshness {
337
+ generated_at: string | null;
338
+ latest_source_at: string | null;
339
+ pack_age_hours: number | null;
340
+ max_pack_age_hours: number;
341
+ stale: boolean;
342
+ reason: 'fresh' | 'pack_age_exceeded' | 'source_newer_than_pack' | 'fallback_required';
343
+ }
344
+
345
+ export interface ContextQualityScore {
346
+ score: number;
347
+ status: 'excellent' | 'good' | 'fragile' | 'critical';
348
+ requiredMissing: number;
349
+ optionalMissing: number;
350
+ conflicts: number;
351
+ fallbackCount: number;
352
+ }
353
+
354
+ export interface ContextPackSummary {
355
+ path?: string;
356
+ context_tier: string;
357
+ semantics_hash: string | null;
358
+ read_order: string[];
359
+ selected_artifacts: ContextArtifactSelection[];
360
+ gaps: ContextGap[];
361
+ conflicts: ContextConflict[];
362
+ fallback_required: boolean;
363
+ freshness: PackFreshness;
364
+ context_quality: ContextQualityScore;
365
+ }
366
+
367
+ export interface ContextQualitySummary {
368
+ primaryWorkflow: string | null;
369
+ primaryScore: number | null;
370
+ primaryStatus: string | null;
371
+ byWorkflow: Record<string, Record<string, unknown>>;
372
+ }
373
+
374
+ export interface SemanticsDriftSummary {
375
+ ok: boolean;
376
+ contractVersion: string;
377
+ manifestPath: string;
378
+ manifest: Record<string, unknown> | null;
379
+ audit: {
380
+ ok: boolean;
381
+ warnings: string[];
382
+ mismatchCount: number;
383
+ mismatches: Array<Record<string, unknown>>;
384
+ targets: Record<string, { path: string; checked: number; missing: boolean }>;
385
+ };
386
+ }
387
+
388
+ export interface PluginSource {
389
+ source: string;
390
+ version?: string;
391
+ }
392
+
192
393
  export interface OxePlugin {
193
394
  name: string;
194
395
  version?: string;
@@ -219,6 +420,47 @@ export interface AgentsAPI {
219
420
  parseCursorCommandFrontmatter: (mdContent: string) => Record<string, unknown>;
220
421
  }
221
422
 
423
+ export interface ContextAPI {
424
+ contextPaths: (projectRoot: string, activeSession?: string | null) => Record<string, unknown>;
425
+ resolveArtifactCandidates: (projectRoot: string, activeSession?: string | null) => Record<string, unknown>;
426
+ buildProjectSummary: (projectRoot: string, activeSession?: string | null, options?: Record<string, unknown>) => Record<string, unknown>;
427
+ buildSessionSummary: (projectRoot: string, activeSession?: string | null, options?: Record<string, unknown>) => Record<string, unknown> | null;
428
+ buildPhaseSummary: (projectRoot: string, activeSession?: string | null, options?: Record<string, unknown>) => Record<string, unknown>;
429
+ buildContextIndex: (projectRoot: string, activeSession?: string | null, options?: Record<string, unknown>) => Record<string, unknown>;
430
+ buildContextPack: (projectRoot: string, input?: Record<string, unknown>) => Record<string, unknown>;
431
+ inspectContextPack: (projectRoot: string, input?: Record<string, unknown>) => Record<string, unknown>;
432
+ buildAllContextPacks: (projectRoot: string, input?: Record<string, unknown>) => Array<Record<string, unknown>>;
433
+ computeContextQuality: (pack: Record<string, unknown>) => Record<string, unknown>;
434
+ computePackFreshness: (pack: Record<string, unknown>, contract?: Record<string, unknown>) => Record<string, unknown>;
435
+ resolvePackFile: (projectRoot: string, workflow: string, activeSession?: string | null) => string;
436
+ summarizeText: (text: string, maxChars?: number, maxLines?: number) => string;
437
+ extractSemanticFragment: (text: string, options?: { intent?: string; maxChars?: number; preserveMarkers?: string[] }) => string;
438
+ parseHypotheses: (planText: string) => CriticalHypothesis[];
439
+ parseConfidenceVector: (planText: string) => ConfidenceVector | null;
440
+ }
441
+
442
+ export interface RuntimeSemanticsAPI {
443
+ CONTRACT_VERSION: string;
444
+ CONTRACTS_PATH: string;
445
+ CONTRACTS_REGISTRY: Record<string, unknown>;
446
+ REQUIRED_CONTRACT_FIELDS: string[];
447
+ RUNTIME_METADATA_KEYS: string[];
448
+ validateWorkflowContractsRegistry: (registry?: Record<string, unknown>) => string[];
449
+ getWorkflowContract: (slug: string) => Record<string, unknown> | null;
450
+ getAllWorkflowContracts: () => Array<Record<string, unknown>>;
451
+ computeSemanticsHash: (slug: string) => string | null;
452
+ getRuntimeMetadataForSlug: (slug: string, options?: Record<string, unknown>) => Record<string, string>;
453
+ renderRuntimeMetadataLines: (meta: Record<string, string>) => string[];
454
+ buildReasoningContractBlock: (meta: Record<string, string>, options?: Record<string, unknown>) => string;
455
+ pickRuntimeMetadata: (frontmatter: Record<string, string>) => Record<string, string>;
456
+ splitFrontmatter: (raw: string) => { frontmatter: string; body: string };
457
+ parseFrontmatterMap: (raw: string) => Record<string, string>;
458
+ slugFromPromptFilename: (name: string) => string;
459
+ slugFromCommandFilename: (name: string) => string;
460
+ auditWrapperText: (slug: string, raw: string) => Record<string, unknown>;
461
+ auditRuntimeTargets: (projectRoot: string) => Record<string, unknown>;
462
+ }
463
+
222
464
  export interface OxeSdk {
223
465
  version: string;
224
466
  name: string;
@@ -228,12 +470,17 @@ export interface OxeSdk {
228
470
 
229
471
  /** Parsing de artefatos OXE. */
230
472
  parsePlan: (planMd: string) => ParsedPlan;
473
+ parseHypotheses: (planText: string) => CriticalHypothesis[];
474
+ parseConfidenceVector: (planText: string) => ConfidenceVector | null;
231
475
  parseSpec: (specMd: string) => ParsedSpec;
232
476
  parseState: (stateMd: string) => ParsedState;
233
477
  validateDecisionFidelity: (discussMd: string, planMd: string) => DecisionFidelityResult;
478
+ parseLessonsMetrics: (metricsJson: string) => LessonMetric[];
479
+ updateLessonMetric: (metrics: LessonMetric[], lessonId: string, outcome: LessonOutcome) => LessonMetric[];
480
+ deprecateLowEffectiveness: (metrics: LessonMetric[], threshold?: number, minObservations?: number) => LessonMetric[];
234
481
 
235
482
  health: {
236
- loadOxeConfigMerged: (targetProject: string) => { config: Record<string, unknown>; path: string | null; parseError: string | null };
483
+ loadOxeConfigMerged: (targetProject: string) => { config: Record<string, unknown>; path: string | null; parseError: string | null; sources: { system: string | null; user: string | null; project: string | null } };
237
484
  validateConfigShape: (cfg: Record<string, unknown>) => { unknownKeys: string[]; typeErrors: string[] };
238
485
  buildHealthReport: (target: string) => OxeHealthReport;
239
486
  suggestNextStep: (target: string, cfg?: { discuss_before_plan?: boolean }) => OxeNextSuggestion;
@@ -244,6 +491,9 @@ export interface OxeSdk {
244
491
  parseLastRetroDate: (stateText: string) => Date | null;
245
492
  isStaleScan: (scanDate: Date | null, maxAgeDays: number) => HealthStaleInfo;
246
493
  isStaleLessons: (retroDate: Date | null, maxAgeDays: number) => HealthStaleInfo;
494
+ copilotWorkspacePaths: (target: string) => { root: string; promptsDir: string; instructions: string; manifest: string };
495
+ copilotLegacyPaths: () => { root: string; promptsDir: string; instructions: string };
496
+ copilotIntegrationReport: (target: string) => CopilotIntegrationReport;
247
497
  planAgentsWarnings: (target: string) => string[];
248
498
  phaseCoherenceWarnings: (phase: string, paths: Record<string, string>) => string[];
249
499
  specSectionWarnings: (specPath: string, requiredHeadings: string[]) => string[];
@@ -291,6 +541,9 @@ export interface OxeSdk {
291
541
  scanFileForSecrets: (filePath: string, options?: { contentPatterns?: RegExp[] }) => SecretScanResult;
292
542
  scanDirForSecretFiles: (dir: string, options?: { secretPatterns?: RegExp[]; maxDepth?: number }) => string[];
293
543
  validatePlanPaths: (filePaths: string[], projectRoot: string) => PlanPathsResult;
544
+ checkFilePermission: (filePath: string, permissions: OxePermissionRule[], currentScope?: string) => { action: string; rule: OxePermissionRule | null };
545
+ checkPermissions: (fileList: string[], permissions: OxePermissionRule[], scope?: string) => PermissionCheckResult;
546
+ globToRegex: (glob: string) => RegExp;
294
547
  DEFAULT_SECRET_PATTERNS: RegExp[];
295
548
  DEFAULT_SECRET_CONTENT_PATTERNS: RegExp[];
296
549
  DEFAULT_DENIED_PATH_PATTERNS: RegExp[];
@@ -302,6 +555,8 @@ export interface OxeSdk {
302
555
  runHook: (plugins: OxePlugin[], hookName: string, ctx: Record<string, unknown>) => Promise<Array<{ plugin: string; error: string }>>;
303
556
  validatePlugins: (projectRoot: string) => PluginValidationResult;
304
557
  initPluginsDir: (projectRoot: string) => void;
558
+ resolvePluginSources: (projectRoot: string, pluginsSources: Array<string | PluginSource>) => { resolved: string[]; errors: Array<{ source: string; error: string }> };
559
+ installNpmPlugin: (projectRoot: string, pkgName: string, version?: string) => { ok: boolean; path: string; error: string };
305
560
  };
306
561
 
307
562
  dashboard: {
@@ -311,6 +566,9 @@ export interface OxeSdk {
311
566
  updatePlanReviewCommentStatus: (projectRoot: string, input?: Record<string, unknown>) => Record<string, unknown> | null;
312
567
  };
313
568
 
569
+ context: ContextAPI;
570
+ runtimeSemantics: RuntimeSemanticsAPI;
571
+
314
572
  operational: {
315
573
  operationalPaths: (projectRoot: string, activeSession: string | null) => Record<string, string | null>;
316
574
  appendEvent: (projectRoot: string, activeSession: string | null, event?: Record<string, unknown>) => Record<string, unknown>;
@@ -323,6 +581,13 @@ export interface OxeSdk {
323
581
  parseCapabilityManifest: (text: string) => Record<string, unknown>;
324
582
  readCapabilityCatalog: (projectRoot: string) => Array<Record<string, unknown>>;
325
583
  buildMemoryLayers: (projectRoot: string, activeSession: string | null) => Record<string, unknown>;
584
+ replayEvents: (projectRoot: string, activeSession: string | null, options?: {
585
+ fromEventId?: string;
586
+ runId?: string;
587
+ waveId?: number;
588
+ limit?: number;
589
+ writeReport?: boolean;
590
+ }) => ReplayReport;
326
591
  };
327
592
 
328
593
  azure: {
@@ -0,0 +1,33 @@
1
+ ---
2
+ oxe_doc: hypotheses
3
+ status: draft
4
+ updated: YYYY-MM-DD
5
+ ---
6
+
7
+ <!--
8
+ Hipóteses Críticas OXE — seção opcional do PLAN.md para tarefas L/XL ou
9
+ com dependências externas. Cada hipótese deve ser validada antes do
10
+ checkpoint declarado; se refutada, registrar bloqueio explícito antes de
11
+ qualquer mutação.
12
+
13
+ Formato recomendado: tags XML dentro do MD (para extração pelo context engine)
14
+ com tabela resumida abaixo para leitura humana.
15
+
16
+ Status possíveis: pending | validated | refuted | skipped
17
+ -->
18
+
19
+ ## Hipóteses Críticas
20
+
21
+ <hypothesis id="H1" checkpoint="T2" status="pending">
22
+ <condition>Descrever a premissa que precisa ser verdadeira para avançar</condition>
23
+ <validation>Comando ou inspeção que prova/refuta a hipótese (ex: npm install && node test/auth.cjs)</validation>
24
+ <on_failure>O que fazer se refutada (ex: bloquear T2, abrir pesquisa de alternativa, replanejar)</on_failure>
25
+ </hypothesis>
26
+
27
+ <!-- Adicionar mais blocos <hypothesis> conforme necessário -->
28
+
29
+ ### Tabela resumida
30
+
31
+ | ID | Hipótese | Checkpoint | Status |
32
+ |-----|------------------------|------------|---------|
33
+ | H1 | (descrição da premissa)| antes de T?| pending |
@@ -14,28 +14,59 @@ inputs: []
14
14
 
15
15
  > Gerado a partir de `.oxe/SPEC.md`. Cada tarefa deve ter bloco **Verificar**.
16
16
 
17
- ## Resumo
18
-
19
- - **Spec vinculada:** (data ou versão informal)
20
- - **Ondas:** (número)
21
- - **Tarefas:** (número)
22
-
23
- ## Autoavaliação do Plano
24
-
25
- - **Melhor plano atual:** sim
26
- - **Confiança:** 80%
27
- - **Base da confiança:**
28
- - Completude dos requisitos: 20/25
29
- - Dependências conhecidas: 12/15
30
- - Risco técnico: 15/20
31
- - Impacto no código existente: 12/15
32
- - Clareza da validação / testes: 13/15
33
- - Lacunas externas / decisões pendentes: 8/10
34
- - **Principais incertezas:** (0–3 bullets)
35
- - **Alternativas descartadas:** (1–2 linhas)
36
- - **Condição para replanejar:** (critério objetivo)
37
-
38
- ## Dependências globais
17
+ ## Resumo
18
+
19
+ - **Spec vinculada:** (data ou versão informal)
20
+ - **Ondas:** (número)
21
+ - **Tarefas:** (número)
22
+
23
+ ## Autoavaliação do Plano
24
+
25
+ - **Melhor plano atual:** sim
26
+ - **Confiança:** 80%
27
+ - **Base da confiança:**
28
+ - Completude dos requisitos: 20/25
29
+ - Dependências conhecidas: 12/15
30
+ - Risco técnico: 15/20
31
+ - Impacto no código existente: 12/15
32
+ - Clareza da validação / testes: 13/15
33
+ - Lacunas externas / decisões pendentes: 8/10
34
+ - **Principais incertezas:** (0–3 bullets)
35
+ - **Alternativas descartadas:** (1–2 linhas)
36
+ - **Condição para replanejar:** (critério objetivo)
37
+
38
+ <confidence_vector cycle="C-NN" generated_at="YYYY-MM-DDTHH:MM:SSZ">
39
+ <dim name="requirements" score="0.80" weight="25" note="completude dos requisitos" />
40
+ <dim name="dependencies" score="0.80" weight="15" note="dependências conhecidas" />
41
+ <dim name="technical_risk" score="0.75" weight="20" note="risco técnico — ajustar se H* pendentes" />
42
+ <dim name="code_impact" score="0.80" weight="15" note="impacto no código existente" />
43
+ <dim name="validation" score="0.87" weight="15" note="clareza da validação / testes" />
44
+ <dim name="open_gaps" score="0.80" weight="10" note="lacunas externas / decisões pendentes" />
45
+ <global score="0.80" gate="proceed_with_risk" />
46
+ </confidence_vector>
47
+
48
+ <!--
49
+ gate possíveis: proceed | proceed_with_risk | refine_first | blocked
50
+ Atualizar este bloco a cada replanejamento; o campo cycle deve coincidir com o ciclo atual.
51
+ -->
52
+
53
+ ## Hipóteses Críticas
54
+
55
+ <!--
56
+ Obrigatório quando houver tarefas L/XL ou dependências de libs externas/APIs.
57
+ Omitir se todas as tarefas forem S/M e sem dependências não verificadas.
58
+ Usar tags XML para extração pelo context engine (ver oxe/templates/HYPOTHESES.template.md).
59
+ -->
60
+
61
+ <!-- Exemplo (remover se não houver hipóteses):
62
+ <hypothesis id="H1" checkpoint="T2" status="pending">
63
+ <condition>lib X disponível no npm sem conflito de versão</condition>
64
+ <validation>npm install X && node -e "require('X')"</validation>
65
+ <on_failure>bloquear T2, avaliar alternativa Y</on_failure>
66
+ </hypothesis>
67
+ -->
68
+
69
+ ## Dependências globais
39
70
 
40
71
  - (ex.: branch base, feature flags, migrations)
41
72
 
@@ -8,6 +8,8 @@
8
8
  - **Criada:** YYYY-MM-DD
9
9
  - **Última atividade:** YYYY-MM-DD
10
10
  - **Resumo:** <uma linha>
11
+ - **Forked from:** —
12
+ - **Forked at:** —
11
13
 
12
14
  ## Índice de artefatos
13
15
 
@@ -0,0 +1,26 @@
1
+ ---
2
+ oxe_skill: true
3
+ id: <skill-id>
4
+ name: <Human Readable Name>
5
+ version: 1.0.0
6
+ type: persona | capability | composite
7
+ scope: global | project
8
+ description: <one-line description>
9
+ invoke: "@<skill-id>"
10
+ references: []
11
+ tags: []
12
+ ---
13
+
14
+ # Skill: <name>
15
+
16
+ ## Descrição
17
+
18
+ (Quando e como usar este skill. Uma ou duas frases.)
19
+
20
+ ## Ativação
21
+
22
+ Mencionar `@<skill-id>` no chat ou incluir na atribuição de agente em plan-agents.json (`"persona": "<skill-id>"`).
23
+
24
+ ## Saída esperada
25
+
26
+ (O que o agente faz ao adotar este skill.)
@@ -36,7 +36,7 @@ Mantenha tags **abertas e fechadas** explicitamente (evita ambiguidade para leit
36
36
  - Template opcional de pasta `docs/` brownfield: [`DOCS_BROWNFIELD_LAYOUT.md`](DOCS_BROWNFIELD_LAYOUT.md) (copiado para `.oxe/templates/` na instalação).
37
37
  - O `SKILL.md` principal do passo deve permanecer o **mapa**: objetivo, contexto essencial, sequência, critérios de sucesso.
38
38
 
39
- ## 4. Comandos Cursor e prompts Copilot (frontmatter)
39
+ ## 4. Comandos Cursor e prompts Copilot (frontmatter)
40
40
 
41
41
  Ficheiros em `.cursor/commands/` e `.github/prompts/` costumam ter YAML inicial:
42
42
 
@@ -49,7 +49,23 @@ description: Resumo de 5–8 palavras. Use quando o utilizador pedir X, Y ou Z.
49
49
  - **Resumo:** o que o passo faz.
50
50
  - **Gatilhos:** frases ou intenções que devem ativar o comando (evita disparar em tudo).
51
51
 
52
- O corpo do ficheiro deve **apontar** para o workflow em `oxe/workflows/<passo>.md` (ou `.oxe/workflows/`) sem duplicar a lógica por completo.
52
+ O corpo do ficheiro deve **apontar** para o workflow em `oxe/workflows/<passo>.md` (ou `.oxe/workflows/`) sem duplicar a lógica por completo.
53
+
54
+ ### Metadata cognitiva multi-runtime
55
+
56
+ Prompts e wrappers OXE podem carregar metadata adicional para sincronizar a postura de raciocínio entre runtimes:
57
+
58
+ ```yaml
59
+ oxe_reasoning_mode: discovery | planning | execution | review | status
60
+ oxe_question_policy: explore_first | ask_high_impact_only | none
61
+ oxe_output_contract: situational | plan | execution | findings | routing
62
+ oxe_tool_profile: read_heavy | write_bounded | review_heavy | mixed
63
+ oxe_confidence_policy: explicit | rubric | optional
64
+ ```
65
+
66
+ - Use a mesma metadata em `.github/prompts/` e `commands/oxe/`.
67
+ - O corpo do wrapper deve incluir um bloco curto de **Contrato de raciocínio OXE deste comando** consistente com essa metadata.
68
+ - Cursor, Codex e CLIs derivados devem preservar essa semântica; não manter regras cognitivas importantes só numa integração.
53
69
 
54
70
  ## 5. Script vs agente
55
71
 
@@ -2,9 +2,10 @@
2
2
  "_comment": "OXE config — copie para .oxe/config.json no seu projeto. Remova esta linha.",
3
3
  "profile": "balanced",
4
4
  "discuss_before_plan": false,
5
- "verification_depth": "standard",
6
- "plan_confidence_threshold": 70,
7
- "security_in_verify": false,
5
+ "verification_depth": "standard",
6
+ "plan_confidence_threshold": 70,
7
+ "security_in_verify": false,
8
+ "adversarial_verify": false,
8
9
  "after_verify_suggest_pr": true,
9
10
  "after_verify_draft_commit": true,
10
11
  "after_verify_suggest_uat": false,
@@ -16,17 +17,18 @@
16
17
  "scan_focus_globs": [],
17
18
  "scan_ignore_globs": [],
18
19
  "spec_required_sections": [],
19
- "plan_max_tasks_per_wave": 0,
20
- "azure": {
21
- "enabled": false,
22
- "default_resource_group": "",
23
- "preferred_locations": [],
24
- "inventory_max_age_hours": 24,
25
- "resource_graph_auto_install": true,
26
- "vpn_required": false
27
- },
28
- "install": {
29
- "profile": "recommended",
20
+ "plan_max_tasks_per_wave": 0,
21
+ "permissions": [],
22
+ "azure": {
23
+ "enabled": false,
24
+ "default_resource_group": "",
25
+ "preferred_locations": [],
26
+ "inventory_max_age_hours": 24,
27
+ "resource_graph_auto_install": true,
28
+ "vpn_required": false
29
+ },
30
+ "install": {
31
+ "profile": "recommended",
30
32
  "repo_layout": "nested",
31
33
  "vscode": false,
32
34
  "include_commands_dir": true,
@@ -5,8 +5,12 @@ Responder perguntas sobre a situação atual do trabalho OXE com máxima robuste
5
5
  </objective>
6
6
 
7
7
  <context>
8
+ - Aplicar `oxe/workflows/references/reasoning-discovery.md` como postura cognitiva deste passo.
8
9
  - Resolver `active_session` via `oxe/workflows/references/session-path-resolution.md`.
9
10
  - Ler sempre `.oxe/STATE.md` global primeiro.
11
+ - Antes de abrir o conjunto amplo de artefatos, tentar o contexto resolvido em `.oxe/context/packs/ask.md` e `.oxe/context/packs/ask.json` como entrada prioritária.
12
+ - Se o pack existir e estiver fresco/coerente, ler primeiro o resumo do pack e depois inspecionar apenas os artefatos listados em `read_order` / `selected_artifacts` antes de expandir a leitura.
13
+ - Se o pack estiver ausente, stale ou com lacunas críticas, fazer fallback explícito para leitura direta e declarar esse fallback na resposta.
10
14
  - Com sessão ativa, priorizar artefatos em `.oxe/<active_session>/...` antes do modo legado.
11
15
  - Usar `.oxe/codebase/` como mapa do repositório, não como substituto dos artefatos da trilha.
12
16
  - Se a pergunta estiver ambígua, responder em modo “situação atual + próximos riscos + melhor próxima ação”.
@@ -15,15 +19,23 @@ Responder perguntas sobre a situação atual do trabalho OXE com máxima robuste
15
19
 
16
20
  <process>
17
21
  1. Ler `.oxe/STATE.md` global e determinar se há `active_session`.
18
- 2. Se houver sessão ativa, ler nesta ordem:
22
+ 2. Resolver o contexto estruturado primeiro:
23
+ - tentar `.oxe/context/packs/ask.md` / `.oxe/context/packs/ask.json` (ou `oxe-cc context inspect --workflow ask --json`) para obter `read_order`, `selected_artifacts`, `gaps`, `conflicts` e `freshness`;
24
+ - se o pack estiver fresco e sem lacunas críticas, usá-lo como mapa primário de leitura;
25
+ - se o pack estiver stale, incompleto ou ausente, declarar `fallback para leitura direta` antes de abrir os artefatos brutos.
26
+ 3. Se houver pack válido, ler primeiro:
27
+ - o resumo humano do pack (`.md`);
28
+ - os artefatos de `read_order`;
29
+ - quaisquer artefatos adicionais de `selected_artifacts` necessários para responder com evidência.
30
+ 4. Se houver sessão ativa e o pack não bastar, ler nesta ordem:
19
31
  - `SESSION.md`
20
32
  - `spec/SPEC.md`, `spec/ROADMAP.md`, `spec/DISCUSS.md`, `spec/UI-SPEC.md` se existirem
21
33
  - `plan/PLAN.md`, `plan/QUICK.md`, `plan/plan-agents.json`, `plan/quick-agents.json` se existirem
22
34
  - `execution/STATE.md`, `execution/EXECUTION-RUNTIME.md`, `execution/CHECKPOINTS.md`, `execution/OBSERVATIONS.md`, `execution/DEBUG.md`, `execution/FORENSICS.md`, `execution/SUMMARY.md` se existirem
23
35
  - `research/INVESTIGATIONS.md`, `research/RESEARCH.md`, `research/investigations/` se existirem
24
36
  - `verification/VERIFY.md`, `verification/VALIDATION-GAPS.md`, `verification/SECURITY.md`, `verification/UI-REVIEW.md` se existirem
25
- 3. Sem sessão ativa, ler o equivalente legado na raiz `.oxe/`.
26
- 4. Em ambos os casos, ler também:
37
+ 5. Sem sessão ativa e se o pack não bastar, ler o equivalente legado na raiz `.oxe/`.
38
+ 6. Em ambos os casos, ler também:
27
39
  - `.oxe/codebase/OVERVIEW.md`
28
40
  - `.oxe/codebase/STACK.md`
29
41
  - `.oxe/codebase/CONCERNS.md`
@@ -33,8 +45,14 @@ Responder perguntas sobre a situação atual do trabalho OXE com máxima robuste
33
45
  - `.oxe/global/LESSONS.md` se existir, com fallback para `.oxe/LESSONS.md`
34
46
  - `.oxe/SESSIONS.md` se a pergunta mencionar sessões, histórico ou retomada
35
47
  - `.oxe/cloud/azure/INVENTORY.md`, `SERVICEBUS.md`, `EVENTGRID.md`, `SQL.md` e `auth-status.json` se a pergunta tocar Azure, cloud, infraestrutura, mensageria, integração ou banco gerido
36
- 5. Responder à pergunta do utilizador com base em evidência explícita dos artefatos lidos.
37
- 6. Se faltar artefato crítico para responder com segurança, dizer exatamente o que falta e qual comando OXE fecha essa lacuna.
48
+ 7. Se a pergunta exigir evidência fora do pack, expandir a leitura apenas para os artefatos adicionais estritamente necessários e mencionar a expansão na resposta.
49
+ 8. Responder à pergunta do utilizador com base em evidência explícita dos artefatos lidos.
50
+ 9. Se faltar artefato crítico para responder com segurança, dizer exatamente o que falta e qual comando OXE fecha essa lacuna.
51
+ 10. Estruturar a resposta conforme o contrato de saída:
52
+ - **Fatos** — o que os artefatos confirmam sem ambiguidade
53
+ - **Inferências** — conclusões derivadas dos artefatos
54
+ - **Lacunas** — o que não pode ser afirmado com segurança
55
+ - **Próximo passo** — apenas quando fizer sentido operacional
38
56
 
39
57
  ## Modo diagnóstico padrão
40
58
 
@@ -49,6 +67,7 @@ Se o utilizador só disser algo genérico como “o que está acontecendo?”,
49
67
  ## Regras de robustez
50
68
 
51
69
  - Não assumir que `doctor` ou `status` sejam session-aware; eles não substituem a leitura direta dos artefatos da sessão.
70
+ - O context pack acelera e comprime a leitura, mas não substitui a evidência. Se ele estiver stale ou insuficiente, o fallback deve ser explícito.
52
71
  - Se houver conflito entre `.oxe/STATE.md` global e `execution/STATE.md` da sessão, explicitar o conflito.
53
72
  - Se houver `CHECKPOINTS.md` com itens `pending_approval`, isso tem precedência operacional sobre o “próximo passo” implícito.
54
73
  - Se `EXECUTION-RUNTIME.md` ou `INVESTIGATIONS.md` existirem, tratá-los como evidência tática complementar para explicar bloqueios, handoffs, riscos e lacunas.
@@ -58,9 +77,11 @@ Se o utilizador só disser algo genérico como “o que está acontecendo?”,
58
77
  </process>
59
78
 
60
79
  <output>
61
- - Resposta direta à pergunta do utilizador
80
+ - **Fatos**
81
+ - **Inferências**
82
+ - **Lacunas**
83
+ - **Próximo passo** (quando necessário)
62
84
  - Referência curta aos artefatos usados
63
- - Quando necessário, um único próximo passo OXE
64
85
  </output>
65
86
 
66
87
  <success_criteria>
@@ -15,9 +15,11 @@ Gerir capabilities nativas do OXE: listar, explicar, instalar, remover e diagnos
15
15
  2. Se o pedido for `list` ou genérico, responder com capabilities instaladas, escopo e riscos.
16
16
  3. Se o pedido for instalar ou remover, orientar o utilizador a usar `oxe-cc capabilities ...` ou o workflow equivalente aprovado pelo projeto.
17
17
  4. Se o pedido for diagnóstico, apontar drift entre índice, manifestos e artefatos esperados.
18
+ 5. Após qualquer operação de install ou remove bem-sucedida, atualizar **`.oxe/STATE.md`**: linha `capabilities_updated: YYYY-MM-DD` ou nota na secção Decisões registando a capability adicionada/removida.
18
19
  </process>
19
20
 
20
21
  <success_criteria>
21
22
  - [ ] O estado do catálogo foi lido a partir dos artefatos reais.
22
23
  - [ ] A resposta deixa claro o que é capability nativa e o que é núcleo do OXE.
24
+ - [ ] `.oxe/STATE.md` foi atualizado quando houve install ou remove (passo 5).
23
25
  </success_criteria>