feat: add graphify plugin and documentation
Build and Push Docker Image / build (push) Failing after 1m35s
Build and Push Docker Image / build (push) Failing after 1m35s
- Introduced a new graphify OpenCode plugin to remind users about the knowledge graph before executing bash commands. - Added AGENTS.md for agent guidance, including development commands, environment setup, Docker deployment, code structure, conventions, and testing instructions. - Created opencode.json to configure the graphify plugin and superpowers. - Updated tests to improve type safety and added missing imports in test files. - Added .graphify_uncached.txt to track relevant files for graphify.
This commit is contained in:
+9489
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+16465
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
AGENTS.md
|
||||
copilot-instructions.md
|
||||
README.md
|
||||
CLAUDE.md
|
||||
IMPROVEMENTS_SUMMARY.md
|
||||
INTEGRATION_EXAMPLE.md
|
||||
tests/README.md
|
||||
app/lib/ERROR_LOGGING_GUIDE.md
|
||||
graphify-out/GRAPH_REPORT.md
|
||||
data/documents/cmmoo4v5p0000ykou0bcivjsn/migr-ein-cmn4ogjc20007dfmmex6engdh-1777488241127.pdf
|
||||
data/documents/cmmoo4v5p0000ykou0bcivjsn/migr-ein-cmn4ogjc20007dfmmex6engdh-1777488343334.pdf
|
||||
data/documents/cmootxs7r0000nvgjmhgbanvx/demo-invoice-1-1777790365605.pdf
|
||||
data/documents/cmootxs7r0000nvgjmhgbanvx/cmopen7qx000s2mzpnq44y0rb-1777790640988.pdf
|
||||
data/documents/cmootxs7r0000nvgjmhgbanvx/cmopejaq8000f2mzpnho6t72z-1777790461825.pdf
|
||||
public/file.svg
|
||||
public/window.svg
|
||||
public/globe.svg
|
||||
public/next.svg
|
||||
public/vercel.svg
|
||||
coverage/favicon.png
|
||||
coverage/sort-arrow-sprite.png
|
||||
@@ -0,0 +1,22 @@
|
||||
// graphify OpenCode plugin
|
||||
// Injects a knowledge graph reminder before bash tool calls when the graph exists.
|
||||
import { existsSync } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
export const GraphifyPlugin = async ({ directory }) => {
|
||||
let reminded = false;
|
||||
|
||||
return {
|
||||
"tool.execute.before": async (input, output) => {
|
||||
if (reminded) return;
|
||||
if (!existsSync(join(directory, "graphify-out", "graph.json"))) return;
|
||||
|
||||
if (input.tool === "bash") {
|
||||
output.args.command =
|
||||
'echo "[graphify] Knowledge graph available. Read graphify-out/GRAPH_REPORT.md for god nodes and architecture context before searching files." && ' +
|
||||
output.args.command;
|
||||
reminded = true;
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
# Annas Rechnungsmanager Agent Guidance
|
||||
|
||||
## Development Commands
|
||||
- Install: `npm install`
|
||||
- Dev server: `npm run dev` (Vite on http://localhost:5173)
|
||||
- Dev with DB: `npm run devfull` (starts docker-compose DB first)
|
||||
- Typecheck: `npm run typecheck` (react-router typegen + tsc)
|
||||
- Lint: `npm run lint` (eslint)
|
||||
- Test: `npm run test` (vitest run)
|
||||
- DB migrate: `npm run db:migrate` (prisma migrate dev)
|
||||
- DB seed: `npm run db:seed` (loads demo data)
|
||||
- DB studio: `npm run db:studio` (Prisma GUI)
|
||||
- Admin setup: `npm run setup-admin` (sets ADMIN_PASSWORD env var or prompts)
|
||||
- Reset password: `npm run reset-password -- --username <user> --password <pass>`
|
||||
- Build: `npm run build`
|
||||
- Start prod: `npm run start`
|
||||
|
||||
## Environment
|
||||
- `.env` required: DATABASE_URL and AUTH_SECRET
|
||||
- Dev: http://localhost:5173
|
||||
- Docker: http://localhost:3000 (first start requires ADMIN_PASSWORD)
|
||||
|
||||
## Docker Deployment
|
||||
- First start: `docker build -t annasrechnungsmanager:latest .` then `docker compose up -d` with ADMIN_PASSWORD set
|
||||
- Subsequent: `docker build -t annasrechnungsmanager:latest .` then `docker compose up -d --no-deps app`
|
||||
- Admin user created/updated on first start with ADMIN_PASSWORD
|
||||
|
||||
## Code Structure
|
||||
- `app/routes/` - file-based routing (React Router v7)
|
||||
- `app/routes/api.*` - REST API endpoints (loader/action)
|
||||
- `app/lib/` - data access, Prisma, tax, utils
|
||||
- `prisma/schema.prisma` - database schema
|
||||
- `scripts/` - setup-admin, reset-password
|
||||
|
||||
## Conventions
|
||||
- TypeScript strict; use unknown/guard checks for external data
|
||||
- UI: Tailwind v4 + shadcn/ui
|
||||
- Error handling: Remix redirect, json, badRequest
|
||||
- API contracts in `app/routes/api.*` must remain backward compatible
|
||||
- Document business logic for complex changes (taxes, invoice codes, UStG §14)
|
||||
|
||||
## Testing
|
||||
- Vitest: `npm run test` (run), `npm run test:watch` (watch)
|
||||
- No additional services required for unit tests
|
||||
|
||||
## graphify
|
||||
|
||||
This project has a graphify knowledge graph at graphify-out/.
|
||||
|
||||
Rules:
|
||||
- Before answering architecture or codebase questions, read graphify-out/GRAPH_REPORT.md for god nodes and community structure
|
||||
- If graphify-out/wiki/index.md exists, navigate it instead of reading raw files
|
||||
- After modifying code files in this session, run `python3 -c "from graphify.watch import _rebuild_code; from pathlib import Path; _rebuild_code(Path('.'))"` to keep the graph current
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"plugin": [
|
||||
".opencode/plugins/graphify.js",
|
||||
"superpowers@git+https://github.com/obra/superpowers.git"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { Decimal } from "@prisma/client";
|
||||
|
||||
describe("Buchungen - Double-Entry Bookkeeping Logic", () => {
|
||||
describe("TransactionAccount Enum", () => {
|
||||
@@ -32,7 +31,7 @@ describe("Buchungen - Double-Entry Bookkeeping Logic", () => {
|
||||
it("should calculate correct sign for EINLAGE (positive)", () => {
|
||||
// EINLAGE increases the company's assets
|
||||
const amount = 1000;
|
||||
const type = "EINLAGE";
|
||||
const type: "EINLAGE" | "ENTNAHME" = "EINLAGE";
|
||||
|
||||
// In German bookkeeping: EINLAGE is recorded as positive (credit to equity)
|
||||
const signedAmount = type === "EINLAGE" ? amount : -amount;
|
||||
@@ -42,7 +41,7 @@ describe("Buchungen - Double-Entry Bookkeeping Logic", () => {
|
||||
it("should calculate correct sign for ENTNAHME (negative)", () => {
|
||||
// ENTNAHME decreases the company's assets
|
||||
const amount = 500;
|
||||
const type = "ENTNAHME";
|
||||
const type: "EINLAGE" | "ENTNAHME" = "ENTNAHME";
|
||||
|
||||
// In German bookkeeping: ENTNAHME is recorded as negative (debit to equity)
|
||||
const signedAmount = type === "EINLAGE" ? amount : -amount;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
import {
|
||||
currencySchema,
|
||||
taxRateSchema,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
import {
|
||||
TAX_RATES,
|
||||
calcItemAmounts,
|
||||
|
||||
Reference in New Issue
Block a user