@besales/ops-framework 0.1.0

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 (70) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +328 -0
  3. package/bin/build-check-context.mjs +67 -0
  4. package/bin/build-execution-ledger.mjs +54 -0
  5. package/bin/estimate-llm-input.mjs +160 -0
  6. package/bin/guard-task.mjs +384 -0
  7. package/bin/hash-task-artifacts.mjs +44 -0
  8. package/bin/init-project.mjs +49 -0
  9. package/bin/intake-execution-feedback.mjs +207 -0
  10. package/bin/intake-feedback.test.mjs +73 -0
  11. package/bin/learning-loop.mjs +658 -0
  12. package/bin/learning-loop.test.mjs +175 -0
  13. package/bin/lib/bootstrap-utils.mjs +542 -0
  14. package/bin/lib/bootstrap-utils.test.mjs +156 -0
  15. package/bin/lib/check-context-utils.mjs +1448 -0
  16. package/bin/lib/check-context-utils.test.mjs +497 -0
  17. package/bin/lib/execution-ledger-utils.mjs +162 -0
  18. package/bin/lib/execution-ledger-utils.test.mjs +74 -0
  19. package/bin/lib/llm-input-pack-utils.mjs +663 -0
  20. package/bin/lib/llm-input-pack-utils.test.mjs +262 -0
  21. package/bin/lib/project-config.mjs +229 -0
  22. package/bin/lib/project-config.test.mjs +102 -0
  23. package/bin/lib/task-manifest-utils.mjs +512 -0
  24. package/bin/lib/task-manifest-utils.test.mjs +218 -0
  25. package/bin/lib/task-metrics-utils.mjs +63 -0
  26. package/bin/lib/task-metrics-utils.test.mjs +40 -0
  27. package/bin/lib/test-setup.mjs +37 -0
  28. package/bin/new-task.mjs +42 -0
  29. package/bin/ops-agent.mjs +81 -0
  30. package/bin/preflight.mjs +56 -0
  31. package/bin/providers/external-cli-checker.mjs +190 -0
  32. package/bin/providers/openai-checker.mjs +62 -0
  33. package/bin/quality-gates.mjs +92 -0
  34. package/bin/run-check.mjs +559 -0
  35. package/bin/run-plan-check-loop.mjs +392 -0
  36. package/bin/run-verify.mjs +627 -0
  37. package/bin/self-lint.mjs +88 -0
  38. package/bin/supervisor-turn.mjs +146 -0
  39. package/bin/supervisor-turn.test.mjs +72 -0
  40. package/bin/task-manifest.mjs +57 -0
  41. package/bin/task-metrics.mjs +48 -0
  42. package/bin/transition.mjs +94 -0
  43. package/bin/validate-check-artifacts.mjs +418 -0
  44. package/config/default-agents.json +100 -0
  45. package/package.json +28 -0
  46. package/playbooks/checker-context.md +9 -0
  47. package/playbooks/complexity-performance.md +13 -0
  48. package/playbooks/production-rollout.md +9 -0
  49. package/playbooks/source-sync-provider.md +9 -0
  50. package/playbooks/ui-acceptance.md +9 -0
  51. package/prompts/checker.md +170 -0
  52. package/prompts/executor.md +54 -0
  53. package/prompts/planner.md +128 -0
  54. package/prompts/researcher.md +44 -0
  55. package/prompts/supervisor.md +337 -0
  56. package/prompts/verifier.md +128 -0
  57. package/templates/brief.md +15 -0
  58. package/templates/check-resolution.md +69 -0
  59. package/templates/check-result.json +32 -0
  60. package/templates/check.md +46 -0
  61. package/templates/execution-feedback.md +25 -0
  62. package/templates/execution.md +101 -0
  63. package/templates/human-gate-summary.md +49 -0
  64. package/templates/orchestration-log.md +8 -0
  65. package/templates/plan.md +86 -0
  66. package/templates/research.md +13 -0
  67. package/templates/retrospective.md +48 -0
  68. package/templates/status.md +53 -0
  69. package/templates/verify-result.json +19 -0
  70. package/templates/verify.md +41 -0
@@ -0,0 +1,73 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { describe, expect, it } from 'vitest';
6
+ import { classifyFeedback } from './intake-execution-feedback.mjs';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+ const opsAgentBin = path.join(__dirname, 'ops-agent.mjs');
11
+
12
+ describe('feedback intake', () => {
13
+ it('records and classifies user feedback at any task stage', () => {
14
+ const taskId = 'TASK-999-feedback-intake';
15
+ const taskDir = path.join(process.cwd(), 'ops', 'agent-pipeline', 'tasks', taskId);
16
+ fs.mkdirSync(taskDir, { recursive: true });
17
+ fs.writeFileSync(path.join(taskDir, 'brief.md'), '# Brief\n\nTest.\n');
18
+ fs.writeFileSync(path.join(taskDir, 'research.md'), '# Research\n\n## Findings\n\n- `docs/example.md`\n');
19
+ fs.writeFileSync(path.join(taskDir, 'plan.md'), '# Plan\n\n## Затронутые модули и файлы\n\n- `docs/example.md`\n');
20
+ fs.writeFileSync(path.join(taskDir, 'status.md'), [
21
+ '# Status',
22
+ '',
23
+ '## Текущий этап',
24
+ '',
25
+ 'Verify',
26
+ '',
27
+ '## Feedback intake',
28
+ '',
29
+ '- `feedback.md`: no_events',
30
+ '',
31
+ '## Latest routing decision',
32
+ '',
33
+ '`verify_review`',
34
+ ].join('\n'));
35
+ fs.writeFileSync(path.join(taskDir, 'orchestration-log.md'), '# Orchestration Log\n\n## Entries\n');
36
+
37
+ const result = spawnSync(process.execPath, [
38
+ opsAgentBin,
39
+ 'intake-feedback',
40
+ taskId,
41
+ 'Нужно изменить verification plan и добавить проверку API route.',
42
+ ], {
43
+ cwd: process.cwd(),
44
+ encoding: 'utf8',
45
+ });
46
+
47
+ expect(result.status).toBe(0);
48
+ const feedback = fs.readFileSync(path.join(taskDir, 'feedback.md'), 'utf8');
49
+ expect(feedback).toContain('## Feedback Event 1');
50
+ expect(feedback).toContain('- Current stage when received: Verify');
51
+ expect(feedback).toContain('- Classification: plan_patch_required');
52
+ expect(feedback).toContain('Supervisor decision: return_plan');
53
+
54
+ const status = fs.readFileSync(path.join(taskDir, 'status.md'), 'utf8');
55
+ expect(status).toContain('## Feedback intake');
56
+ expect(status).toContain('- `feedback.md`: classified');
57
+
58
+ const log = fs.readFileSync(path.join(taskDir, 'orchestration-log.md'), 'utf8');
59
+ expect(log).toContain('feedback_intake');
60
+ });
61
+
62
+ it('classifies ambiguous feedback for human triage', () => {
63
+ expect(classifyFeedback('Мне кажется, что-то тут не так').classification).toBe('human_triage_required');
64
+ });
65
+
66
+ it('classifies process learning feedback without invalidating current scope', () => {
67
+ const result = classifyFeedback('Нужно логировать feedback для retrospective, memory и playbook learning.');
68
+
69
+ expect(result.classification).toBe('learning_capture');
70
+ expect(result.supervisorDecision).toBe('stay_current');
71
+ expect(result.requiresFreshCheck).toBe(false);
72
+ });
73
+ });