toga-ai 1.0.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 (62) hide show
  1. package/.claude/settings.json +119 -0
  2. package/.claude-plugin/marketplace.json +87 -0
  3. package/.claude-plugin/plugin.json +22 -0
  4. package/CLAUDE.md +161 -0
  5. package/README.md +72 -0
  6. package/agents/framework-pattern-checker.md +67 -0
  7. package/agents/harness-optimizer.md +102 -0
  8. package/agents/knowledge-writer.md +62 -0
  9. package/agents/php-build-resolver.md +51 -0
  10. package/agents/php-reviewer.md +51 -0
  11. package/agents/planner.md +88 -0
  12. package/agents/session-capture.md +101 -0
  13. package/agents/sql-reviewer.md +67 -0
  14. package/contexts/dev.md +43 -0
  15. package/contexts/research.md +49 -0
  16. package/contexts/review.md +37 -0
  17. package/knowledge/1.0/apps/library/INDEX.md +5 -0
  18. package/knowledge/1.0/apps/library/architecture.md +105 -0
  19. package/knowledge/1.0/apps/worker/INDEX.md +5 -0
  20. package/knowledge/1.0/apps/worker/architecture.md +223 -0
  21. package/knowledge/1.0/standards/backend-php.md +450 -0
  22. package/knowledge/2.0/apps/_underscore/INDEX.md +6 -0
  23. package/knowledge/2.0/apps/_underscore/architecture.md +183 -0
  24. package/knowledge/2.0/apps/_underscore/features/recursive-item-fulfillments.md +111 -0
  25. package/knowledge/2.0/apps/api2/INDEX.md +5 -0
  26. package/knowledge/2.0/apps/api2/architecture.md +162 -0
  27. package/knowledge/2.0/apps/worker2/INDEX.md +6 -0
  28. package/knowledge/2.0/apps/worker2/architecture.md +127 -0
  29. package/knowledge/2.0/apps/worker2/features/creating-worker-actions.md +135 -0
  30. package/knowledge/2.0/standards/backend-php.md +710 -0
  31. package/knowledge/CONVENTIONS.md +117 -0
  32. package/knowledge/INDEX.md +19 -0
  33. package/knowledge/clients/.gitkeep +0 -0
  34. package/knowledge/registry.json +7 -0
  35. package/knowledge.js +384 -0
  36. package/mcp-configs/README.md +72 -0
  37. package/mcp-configs/mcp-servers.json +23 -0
  38. package/package.json +50 -0
  39. package/rules/README.md +53 -0
  40. package/rules/common/coding-style.md +123 -0
  41. package/rules/common/git-workflow.md +72 -0
  42. package/rules/common/security.md +118 -0
  43. package/rules/common/testing.md +74 -0
  44. package/rules/php/app-framework.md +104 -0
  45. package/rules/php/underscore-framework.md +111 -0
  46. package/scripts/harness.js +605 -0
  47. package/scripts/hooks/evaluate-session.js +55 -0
  48. package/scripts/hooks/post-edit-validate.js +102 -0
  49. package/scripts/hooks/session-end.js +13 -0
  50. package/scripts/hooks/session-start.js +57 -0
  51. package/scripts/install.js +611 -0
  52. package/scripts/pre-commit +46 -0
  53. package/skills/capture/SKILL.md +294 -0
  54. package/skills/code-review/SKILL.md +140 -0
  55. package/skills/create-elastic-beanstalk/SKILL.md +217 -0
  56. package/skills/harness-audit/SKILL.md +152 -0
  57. package/skills/kickoff/SKILL.md +151 -0
  58. package/skills/php-patterns/SKILL.md +296 -0
  59. package/skills/session-resume/SKILL.md +156 -0
  60. package/skills/session-save/SKILL.md +158 -0
  61. package/skills/sync-team-skills/SKILL.md +87 -0
  62. package/sync-skills.js +71 -0
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ function getFilePath() {
9
+ // Try environment variable first (Claude Code passes tool input as JSON here)
10
+ const toolInput = process.env.CLAUDE_TOOL_INPUT;
11
+ if (toolInput) {
12
+ try {
13
+ const parsed = JSON.parse(toolInput);
14
+ // Write tool uses 'file_path'; Edit uses 'file_path'; MultiEdit uses 'file_path'
15
+ if (parsed.file_path) return parsed.file_path;
16
+ if (parsed.path) return parsed.path;
17
+ } catch (e) {
18
+ // Not JSON — treat as raw path
19
+ return toolInput.trim();
20
+ }
21
+ }
22
+
23
+ // Fall back to stdin
24
+ try {
25
+ const stdin = fs.readFileSync('/dev/stdin', 'utf8').trim();
26
+ if (stdin) {
27
+ try {
28
+ const parsed = JSON.parse(stdin);
29
+ if (parsed.file_path) return parsed.file_path;
30
+ if (parsed.path) return parsed.path;
31
+ } catch (e) {
32
+ return stdin;
33
+ }
34
+ }
35
+ } catch (e) {
36
+ // stdin not available
37
+ }
38
+
39
+ return null;
40
+ }
41
+
42
+ function isKnowledgeFile(filePath) {
43
+ if (!filePath) return false;
44
+ // Normalize path separators
45
+ const normalized = filePath.replace(/\\/g, '/');
46
+ return normalized.includes('knowledge/') && !normalized.includes('INDEX.md');
47
+ }
48
+
49
+ function main() {
50
+ const filePath = getFilePath();
51
+
52
+ if (!isKnowledgeFile(filePath)) {
53
+ process.exit(0);
54
+ }
55
+
56
+ // Hook lives at .claude/hooks/toga/post-edit-validate.js
57
+ // knowledge.js is installed at .claude/knowledge.js — two levels up from __dirname
58
+ const knowledgeJs = path.resolve(__dirname, '../../knowledge.js');
59
+
60
+ if (!fs.existsSync(knowledgeJs)) {
61
+ process.exit(0);
62
+ }
63
+
64
+ try {
65
+ const output = execSync('node "' + knowledgeJs + '" validate', {
66
+ cwd: path.resolve(__dirname, '../../..'),
67
+ timeout: 15000,
68
+ encoding: 'utf8',
69
+ stdio: ['ignore', 'pipe', 'pipe'],
70
+ });
71
+
72
+ // Filter to only show errors and warnings
73
+ const lines = output.split('\n').filter((line) => {
74
+ return /ERROR|WARNING|FAILED|✗|⚠/.test(line);
75
+ });
76
+
77
+ if (lines.length > 0) {
78
+ console.log('');
79
+ console.log('Knowledge validation issues after editing ' + path.basename(filePath) + ':');
80
+ lines.slice(0, 20).forEach((line) => console.log(' ' + line));
81
+ console.log('');
82
+ console.log('Fix errors before committing. Run `node knowledge.js validate` for full output.');
83
+ console.log('');
84
+ }
85
+ } catch (e) {
86
+ // execSync throws on non-zero exit — output is in e.stdout/e.stderr
87
+ const combined = ((e.stdout || '') + (e.stderr || '')).trim();
88
+ if (combined) {
89
+ console.log('');
90
+ console.log('Knowledge validation failed after editing ' + path.basename(filePath) + ':');
91
+ combined.split('\n').slice(0, 20).forEach((line) => console.log(' ' + line));
92
+ console.log('');
93
+ console.log('Fix errors before committing. Run `node knowledge.js validate` for full output.');
94
+ console.log('');
95
+ }
96
+ }
97
+
98
+ // Always exit 0 — warn, do not block the edit
99
+ process.exit(0);
100
+ }
101
+
102
+ main();
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ function main() {
5
+ console.log('');
6
+ console.log('Session ending.');
7
+ console.log(' Run /capture to save learnings to the knowledge base.');
8
+ console.log(' Run /session-save to persist session state for resuming next time.');
9
+ console.log('');
10
+ process.exit(0);
11
+ }
12
+
13
+ main();
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const TIPS = [
8
+ 'Run /kickoff before writing any code — it primes Claude with your repo\'s architecture and standards.',
9
+ 'Use `node knowledge.js search --repo=<repo> --q=<keywords>` to find relevant docs before diving into code.',
10
+ 'Run /capture at the end of your session — patterns you discovered today help the whole team tomorrow.',
11
+ 'Run /session-save before closing a long session so you can resume exactly where you left off.',
12
+ 'Use /planner before implementing a complex feature — 5 minutes of planning saves hours of rework.',
13
+ 'Run `node knowledge.js deps --repo=<repo>` to see which architecture docs to load for your work.',
14
+ 'Use /code-review after writing a new PHP file — catch security issues before they reach production.',
15
+ ];
16
+
17
+ function getTip() {
18
+ const dayIndex = Math.floor(Date.now() / 86400000) % TIPS.length;
19
+ return TIPS[dayIndex];
20
+ }
21
+
22
+ function checkUnfinishedSession(cwd) {
23
+ const sessionFile = path.join(cwd, '.session-latest.md');
24
+ return fs.existsSync(sessionFile);
25
+ }
26
+
27
+ function main() {
28
+ const cwd = process.cwd();
29
+ const now = new Date().toLocaleDateString('en-US', {
30
+ weekday: 'long',
31
+ year: 'numeric',
32
+ month: 'long',
33
+ day: 'numeric',
34
+ });
35
+
36
+ console.log('');
37
+ console.log('================================================');
38
+ console.log(' TOGA Team Knowledge — ' + now);
39
+ console.log('================================================');
40
+ console.log('');
41
+ console.log('Tip of the day:');
42
+ console.log(' ' + getTip());
43
+ console.log('');
44
+
45
+ if (checkUnfinishedSession(cwd)) {
46
+ console.log('Unfinished session detected.');
47
+ console.log(' Run /session-resume latest to reload your previous session state.');
48
+ console.log('');
49
+ }
50
+
51
+ console.log('Ready. Run /kickoff to prime context for your work session.');
52
+ console.log('');
53
+
54
+ process.exit(0);
55
+ }
56
+
57
+ main();