agjan 0.0.19 → 0.0.21
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.
- package/dist/adapters/claude-code.js +9 -3
- package/dist/auto.js +4 -0
- package/dist/baseline.js +11 -8
- package/dist/cli.js +8 -0
- package/dist/commands/check.js +65 -13
- package/dist/commands/gates.js +9 -1
- package/dist/commands/lint.js +16 -5
- package/dist/commands/log.js +1 -1
- package/dist/commands/new.js +4 -3
- package/dist/commands/setup.js +91 -81
- package/dist/commands/skill.js +22 -0
- package/dist/commands/summary.js +37 -0
- package/dist/config.js +24 -0
- package/dist/fix.js +13 -10
- package/dist/git.js +57 -9
- package/dist/launcher.js +9 -3
- package/dist/progress-view.js +36 -23
- package/dist/progress.js +103 -38
- package/dist/qa.js +10 -5
- package/dist/review-policy.js +4 -1
- package/dist/review.js +82 -35
- package/dist/schema.js +85 -0
- package/dist/scope.js +12 -4
- package/dist/story.js +110 -0
- package/dist/tests-map.js +17 -11
- package/docs/guide.md +52 -7
- package/kit/domains/btp/domain.json +2 -2
- package/kit/hooks/guard.mjs +53 -9
- package/kit/skills/agjan-build/SKILL.md +19 -7
- package/kit/skills/agjan-design/SKILL.md +20 -1
- package/kit/skills/agjan-fix/SKILL.md +1 -1
- package/kit/skills/agjan-spec/SKILL.md +9 -3
- package/kit/skills/agjan-spec/references/elicitation.md +135 -0
- package/kit/skills/agjan-verify/SKILL.md +9 -1
- package/kit/skills/btp-architect/SKILL.md +7 -2
- package/kit/skills/btp-architect/references/deployment.md +43 -0
- package/kit/skills/btp-architect/references/security.md +59 -4
- package/kit/skills/cap-developer/SKILL.md +19 -7
- package/kit/skills/cap-developer/references/agents.md +90 -0
- package/kit/skills/cap-developer/references/handlers.md +88 -9
- package/kit/skills/cap-developer/references/modeling.md +41 -0
- package/kit/skills/cap-developer/references/project-setup.md +57 -7
- package/kit/skills/cap-developer/references/services.md +172 -7
- package/kit/skills/cap-developer/references/testing.md +79 -6
- package/kit/skills/cap-developer/references/typescript.md +8 -7
- package/kit/skills/cap-developer/references/validation-security.md +74 -2
- package/kit/skills/fiori-developer/SKILL.md +21 -1
- package/kit/skills/fiori-developer/references/accessibility.md +65 -0
- package/kit/skills/fiori-developer/references/app-setup.md +10 -3
- package/kit/skills/fiori-developer/references/elements-cookbook.md +71 -0
- package/kit/skills/fiori-developer/references/elements.md +82 -9
- package/kit/skills/fiori-developer/references/freestyle-ts.md +27 -0
- package/kit/skills/fiori-developer/references/testing.md +5 -0
- package/kit/skills/fiori-developer/references/ui5-basics.md +34 -1
- package/kit/skills/qa-tester/SKILL.md +11 -4
- package/kit/skills/qa-tester/references/techniques.md +123 -0
- package/kit/skills/solution-reviewer/SKILL.md +10 -0
- package/kit/skills/solution-reviewer/references/defects.md +154 -0
- package/kit/templates/agents-block.md +1 -1
- package/kit/templates/agjan-ci.yml +3 -0
- package/package.json +1 -1
- package/schemas/config.schema.json +1 -1
- package/schemas/reviews.schema.json +1 -1
package/kit/hooks/guard.mjs
CHANGED
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
* `cd … &&`, `node …/agjan.mjs`). It is a guardrail in front of the terminal
|
|
7
7
|
* confirmation, not a proof (design 9.4).
|
|
8
8
|
*
|
|
9
|
+
* It denies shell commands that start the agjan MCP server or call its record tools: they
|
|
10
|
+
* belong to the reviewer and QA agents (design decision 52).
|
|
11
|
+
*
|
|
9
12
|
* It denies file edits by shell or script commands (python/node scripts that write files,
|
|
10
13
|
* sed -i, cat > file, …) so that agents use their file edit tool, unless the project sets
|
|
11
14
|
* `agent.script_edits` to "allow" (design decision 63).
|
|
12
15
|
*
|
|
13
16
|
* File edit tools (Copilot `edit`/`create`, Claude Code `Edit`/`Write`/`MultiEdit`): hand
|
|
14
|
-
* edits of agjan's records (approvals.json, reviews.json, review.md, log.jsonl,
|
|
15
|
-
* denied.
|
|
17
|
+
* edits of agjan's records (approvals.json, reviews.json, review.md, log.jsonl, the review
|
|
18
|
+
* contexts in .agjan/, …) are always denied.
|
|
16
19
|
*
|
|
17
20
|
* The guard only denies. Everything else is left to the host, which asks the user as it
|
|
18
21
|
* is configured to (design decision 76).
|
|
@@ -38,8 +41,43 @@ import { fileURLToPath } from 'node:url';
|
|
|
38
41
|
const REASON =
|
|
39
42
|
'agjan approve, accept, reject, auto and models set are for the human, in a terminal. Do not run them in any form; ask the user to run the command.';
|
|
40
43
|
|
|
41
|
-
/**
|
|
42
|
-
|
|
44
|
+
/**
|
|
45
|
+
* agjan started as a command, up to its subcommand: the bin (`agjan`, `agjan.mjs`, the Windows
|
|
46
|
+
* shims `agjan.cmd` and `agjan.ps1`) or a package spec (`npx agjan@0.0.20`, `agjan@latest`),
|
|
47
|
+
* then any of the launcher's `--yes` / `-y` and npm exec's `--`.
|
|
48
|
+
*/
|
|
49
|
+
const AGJAN = String.raw`\bagjan(?:\.(?:mjs|cmd|ps1))?(?:@[\w.^~*-]+)?["']?(?:\s+(?:--|-y|--yes)(?=\s))*\s+["']?`;
|
|
50
|
+
|
|
51
|
+
/** agjan followed by a human-only command. */
|
|
52
|
+
const HUMAN_ONLY = new RegExp(`${AGJAN}(approve|accept|reject|auto|models\\s+set)\\b`);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A human-only command named only as text, not run: quoted, as the pattern of a search
|
|
56
|
+
* (`grep`, `rg`, `git grep`, `git log --grep`) or a commit message, with nothing else in the
|
|
57
|
+
* line that could run it: no other command, pipe or redirect, no command substitution (a
|
|
58
|
+
* shell expands it even inside double quotes), no option that runs a command (`rg --pre`, a
|
|
59
|
+
* pager).
|
|
60
|
+
*/
|
|
61
|
+
function onlyMentioned(/** @type {string} */ command) {
|
|
62
|
+
const plain = unquoted(command);
|
|
63
|
+
if (HUMAN_ONLY.test(plain) || /`|\$\(/.test(command) || /[|;&<>()]/.test(plain)) return false;
|
|
64
|
+
if (/\s(?:--pre|--pager|--open-files-in-pager|--ext-diff|--textconv)\b|\s-O/.test(plain)) return false;
|
|
65
|
+
return /^\s*(?:grep|egrep|fgrep|rg|ack|git\s+(?:grep|log|commit))\s/.test(plain);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const REVIEW_REASON =
|
|
69
|
+
'The agjan MCP server and its tools belong to the reviewer and QA agents, which the host starts for them. Do not start agjan mcp or call review_record or qa_record yourself: delegate the review to the reviewer agent, as the skill says.';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Starting the agjan MCP server from a shell, or naming its record tools (a JSON-RPC call
|
|
73
|
+
* piped into it, a script that calls them): the main agent would record its own review
|
|
74
|
+
* (design decision 52). The hosts start the reviewer's server themselves, not through a
|
|
75
|
+
* shell tool, so the reviewer and the QA agent keep their tools.
|
|
76
|
+
*/
|
|
77
|
+
const REVIEW_SERVER = new RegExp(`${AGJAN}mcp\\b`);
|
|
78
|
+
const RECORD_TOOLS = /\b(?:review_record|qa_record|recordReview|recordQa)\b/;
|
|
79
|
+
/** The review contexts in .agjan/, which review_record checks a result against. */
|
|
80
|
+
const CONTEXT_FILES = /\.agjan[\\/]+review-contexts\b/;
|
|
43
81
|
|
|
44
82
|
const BRANCH_REASON =
|
|
45
83
|
'Create branches with npx agjan branch, not with git. Ask the user first: create a new branch (your proposed name or one they type) or use an existing branch (npx agjan branch --list, then npx agjan branch --use <name>).';
|
|
@@ -48,13 +86,14 @@ const BRANCH_REASON =
|
|
|
48
86
|
* Commands that create or rename a branch: git switch -c/-C, git checkout -b/-B/--orphan,
|
|
49
87
|
* git branch <name> (also -m/-c), git worktree add -b. Always denied: agents create branches
|
|
50
88
|
* with npx agjan branch after asking the user (design decision 62); git options such as
|
|
51
|
-
* `-C <dir>` may come before.
|
|
89
|
+
* `-C <dir>` may come before. `git branch` followed by a pipe, a redirect (`2>/dev/null`) or
|
|
90
|
+
* another command only lists the branches.
|
|
52
91
|
*/
|
|
53
92
|
const BRANCH_CREATE = new RegExp(
|
|
54
93
|
String.raw`\bgit(?:\s+-[cC]\s+\S+|\s+--[\w-]+(?:=\S+)?)*\s+` +
|
|
55
94
|
String.raw`(?:switch\s+(?:\S+\s+)*?(?:-c|-C|--create|--force-create)\b` +
|
|
56
95
|
String.raw`|checkout\s+(?:\S+\s+)*?(?:-b|-B|--orphan)\b` +
|
|
57
|
-
String.raw`|branch\s+(?:(?:-[mMcCf]|--move|--copy|--force)\s+)*[^-\s]` +
|
|
96
|
+
String.raw`|branch\s+(?:(?:-[mMcCf]|--move|--copy|--force)\s+)*(?!\d*[<>])[^-\s|&;<>()]` +
|
|
58
97
|
String.raw`|worktree\s+add\s+(?:\S+\s+)*?-[bB]\b)`,
|
|
59
98
|
);
|
|
60
99
|
|
|
@@ -92,8 +131,12 @@ function unquoted(command) {
|
|
|
92
131
|
const RECORD_REASON =
|
|
93
132
|
'agjan writes this file itself (approvals, reviews, logs, progress, fix records, baseline). Never edit it by hand; use the agjan commands.';
|
|
94
133
|
|
|
95
|
-
/**
|
|
96
|
-
|
|
134
|
+
/**
|
|
135
|
+
* agjan's records inside docs/agjan/, and what it keeps for them in .agjan/ (the auto mode
|
|
136
|
+
* default, the review contexts that review_record checks a result against): never edited by
|
|
137
|
+
* an agent's edit tool.
|
|
138
|
+
*/
|
|
139
|
+
const RECORD = /^docs\/agjan\/(?:.+\/)?(?:approvals\.json|reviews\.json|review\.md|log\.jsonl|progress\.md|report\.md|fix\.json|fix\.md)$|^docs\/agjan\/baseline\.json$|^\.agjan\/auto\.json$|^\.agjan\/review-contexts\//;
|
|
97
140
|
|
|
98
141
|
const AUTO_REASON =
|
|
99
142
|
'The auto mode default (.agjan/auto.json) is the user\'s, set with npx agjan auto on --default in their terminal. Do not read, write, copy or remove it.';
|
|
@@ -141,7 +184,8 @@ export function decide(payload, config = {}, root = process.env.CLAUDE_PROJECT_D
|
|
|
141
184
|
if (EDIT_TOOLS.has(payload?.toolName ?? payload?.tool_name ?? '')) return decideEdit(payload, root);
|
|
142
185
|
const command = payload?.toolArgs?.command ?? payload?.tool_input?.command;
|
|
143
186
|
if (typeof command !== 'string') return null;
|
|
144
|
-
if (HUMAN_ONLY.test(command)) return answer(payload, 'deny', REASON);
|
|
187
|
+
if (HUMAN_ONLY.test(command) && !onlyMentioned(command)) return answer(payload, 'deny', REASON);
|
|
188
|
+
if (REVIEW_SERVER.test(command) || RECORD_TOOLS.test(command) || CONTEXT_FILES.test(command)) return answer(payload, 'deny', REVIEW_REASON);
|
|
145
189
|
if (BRANCH_CREATE.test(command)) return answer(payload, 'deny', BRANCH_REASON);
|
|
146
190
|
if (AUTO_FILE.test(command)) return answer(payload, 'deny', AUTO_REASON);
|
|
147
191
|
if (config?.agent?.script_edits !== 'allow' && SCRIPT_EDITS.some((matches) => matches(command))) return answer(payload, 'deny', EDIT_REASON);
|
|
@@ -8,6 +8,12 @@ description: Build an approved agjan design task by task, within the approved pa
|
|
|
8
8
|
Implement `tasks.md` in order. The approved design is the contract: build what it says,
|
|
9
9
|
where it says.
|
|
10
10
|
|
|
11
|
+
## Arriving in auto mode
|
|
12
|
+
|
|
13
|
+
In auto mode you reach this skill from the previous one within one run, through `npx agjan skill build`.
|
|
14
|
+
Then start step 1 at once, with a tool call: no summary of the work so far first (the user gets it
|
|
15
|
+
when the run ends, `npx agjan summary`), and no request to run `/agjan-build`: you are running it.
|
|
16
|
+
|
|
11
17
|
## 1. Preconditions
|
|
12
18
|
|
|
13
19
|
`npx agjan status` must show `stage: build` (spec and design approved). Otherwise stop
|
|
@@ -55,13 +61,19 @@ Do not change it silently; `agjan check` fails on it.
|
|
|
55
61
|
|
|
56
62
|
## 4. Done
|
|
57
63
|
|
|
58
|
-
When `npx agjan status` says all tasks are done and reviewed
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
When `npx agjan status` says all tasks are done and reviewed:
|
|
65
|
+
|
|
66
|
+
- **Manual mode:** put the output of `npx agjan summary` into your message unchanged, in a
|
|
67
|
+
code block (what has been done so far, in plain words, and what the work waits for), then
|
|
68
|
+
tell the user to run `/agjan-verify`.
|
|
69
|
+
- **Auto mode** (`npx agjan status` shows `auto on`): do not stop. Your next action is the
|
|
70
|
+
shell command `npx agjan skill verify` (it works on every host), then
|
|
71
|
+
follow that skill; put a one-line note for the user into the same reply, since a reply
|
|
72
|
+
without a tool call ends your run. Do not end your reply with "run `/agjan-verify`": in
|
|
73
|
+
auto mode that is your next action. The summary comes in the final message of
|
|
74
|
+
`/agjan-verify`.
|
|
75
|
+
|
|
76
|
+
Its final acceptance, `npx agjan approve verify`, stays with the user in every mode.
|
|
65
77
|
|
|
66
78
|
## Never
|
|
67
79
|
|
|
@@ -8,6 +8,12 @@ description: Full-mode agjan design. After the spec is approved, the role skills
|
|
|
8
8
|
Answer the approved spec technically: areas, decisions, tasks. Light changes are
|
|
9
9
|
designed by `/agjan-spec`; this skill is for full mode.
|
|
10
10
|
|
|
11
|
+
## Arriving in auto mode
|
|
12
|
+
|
|
13
|
+
In auto mode you reach this skill from the previous one within one run, through `npx agjan skill design`.
|
|
14
|
+
Then start step 1 at once, with a tool call: no summary of the work so far first (the user gets it
|
|
15
|
+
when the run ends, `npx agjan summary`), and no request to run `/agjan-design`: you are running it.
|
|
16
|
+
|
|
11
17
|
## 1. Preconditions
|
|
12
18
|
|
|
13
19
|
Run `npx agjan status`. The spec must be `approved`. If it is not, stop and tell the
|
|
@@ -42,6 +48,19 @@ entity; "no draft" is only for read-only apps or apps that change data through a
|
|
|
42
48
|
(fiori-developer). An AC the design cannot meet in the UI is a design error, not a
|
|
43
49
|
build problem.
|
|
44
50
|
|
|
51
|
+
Then check the decisions for production, with the rules of the role skills you read:
|
|
52
|
+
|
|
53
|
+
| Area | Decide for the feature |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `cap` (rule 6) | rows and paging, who changes a row at the same time (draft lock or `@odata.etag`), the fields only the server sets, personal data, where demo rows go |
|
|
56
|
+
| `btp` (rules 6 and 7) | how each new app is served, how persisted data moves when the model renames or deletes it, the identity service |
|
|
57
|
+
| `fiori` ("What every elements app gets right") | side effects and per-row availability of actions, confirmations, parameter labels, messages, value helps |
|
|
58
|
+
|
|
59
|
+
Write a decision for each point that applies, or one line under `## Risks and trade-offs`
|
|
60
|
+
why it does not. Each non-functional requirement of the spec gets a decision that meets
|
|
61
|
+
it. This is how the feature is built, not more scope: add nothing the spec does not ask
|
|
62
|
+
for.
|
|
63
|
+
|
|
45
64
|
Then fill `## Answers to open technical questions` (one answer per question in the
|
|
46
65
|
spec) and `## Risks and trade-offs`.
|
|
47
66
|
|
|
@@ -99,7 +118,7 @@ passing one.
|
|
|
99
118
|
automatically. Commit the feature folder with the message it gives, show the user the
|
|
100
119
|
last review report and one line that the gate passed in auto mode, and
|
|
101
120
|
continue without stopping: your next action is the shell command
|
|
102
|
-
`
|
|
121
|
+
`npx agjan skill build` (it works on every host), then follow that skill.
|
|
103
122
|
Put the one line for the user into the same reply as that command: a reply without a
|
|
104
123
|
tool call ends your run, and the user has to start it again. Do not end your reply with
|
|
105
124
|
"run `/agjan-build`": in auto mode that is your next action, not the user's.
|
|
@@ -6,7 +6,7 @@ description: Fast path for a small agjan change (a bug fix, a label, a small cor
|
|
|
6
6
|
# /agjan-fix
|
|
7
7
|
|
|
8
8
|
A small change to existing files, checked by script and reviewed, without Spec and
|
|
9
|
-
Design.
|
|
9
|
+
Design. A human still reviews and merges the pull request.
|
|
10
10
|
|
|
11
11
|
## 1. Is it a fix?
|
|
12
12
|
|
|
@@ -53,6 +53,10 @@ To start a feature:
|
|
|
53
53
|
- Ask the user only what the business needs: who, what, why, what is out of scope.
|
|
54
54
|
One round of questions at most; put remaining uncertainty into the spec as open
|
|
55
55
|
questions.
|
|
56
|
+
- Before you ask, go through `.claude/skills/agjan-spec/references/elicitation.md`: the
|
|
57
|
+
gaps a senior business analyst closes (who may do what, the life of a record, limits,
|
|
58
|
+
personal data, two people at once, volumes, what the user is told, other systems). Ask
|
|
59
|
+
the ones the request leaves open and whose answer changes the result.
|
|
56
60
|
|
|
57
61
|
## 3. Write `docs/agjan/<slug>/spec.md`
|
|
58
62
|
|
|
@@ -66,7 +70,9 @@ Keep the template's headings exactly (they are checked). Write the text in the l
|
|
|
66
70
|
- Never make technical decisions the requester did not ask for. Write technical
|
|
67
71
|
questions under `## Open technical questions`; Design answers them.
|
|
68
72
|
- Acceptance criteria: `### <KEY>-AC1`, `### <KEY>-AC2`, ... each with `Given`,
|
|
69
|
-
`When`, `Then` lines. Each must be testable by someone who did not
|
|
73
|
+
`When`, `Then` lines (`And` adds one). Each must be testable by someone who did not
|
|
74
|
+
write it: concrete data, an observable outcome, an AC for the user who may not, and one
|
|
75
|
+
at the edge of every limit (elicitation.md, "Writing the acceptance criteria"). Add
|
|
70
76
|
`Verification: manual` only when an automated test is not practical (for example
|
|
71
77
|
visual layout); the default is automated.
|
|
72
78
|
- `## Authorization` says who may do what, in business roles.
|
|
@@ -135,8 +141,8 @@ with it yourself right away (step 3 below), otherwise the user runs `/agjan-desi
|
|
|
135
141
|
automatically (it says `approved … automatically`). Commit the feature folder with the
|
|
136
142
|
message it gives, show the user the `npx agjan review report` of the last review and
|
|
137
143
|
one line that the gate passed in auto mode, and continue without stopping: your next
|
|
138
|
-
action is the shell command `
|
|
139
|
-
|
|
144
|
+
action is the shell command `npx agjan skill design` (it works on every host;
|
|
145
|
+
`npx agjan skill build` after the combined gate `spec design`), then follow that skill. Put the one line
|
|
140
146
|
for the user into the same reply as that command: a reply without a tool call ends
|
|
141
147
|
your run, and the user has to start it again.
|
|
142
148
|
Do not end your reply with "run `/agjan-design`" (or `/agjan-build`): in auto mode that
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# What a senior business analyst asks
|
|
2
|
+
|
|
3
|
+
The questions that decide whether a feature works for its users, and that a spec most
|
|
4
|
+
often leaves open. All of them are business questions: ask them in the user's words,
|
|
5
|
+
and never answer one with a technology (that is Design's work).
|
|
6
|
+
|
|
7
|
+
Ask only what the request leaves open and the answer changes the result. One round of
|
|
8
|
+
questions at most (`SKILL.md`, section 2); what stays open goes into the spec as an open
|
|
9
|
+
question, a technical one under `## Open technical questions`.
|
|
10
|
+
|
|
11
|
+
## Who may do what
|
|
12
|
+
|
|
13
|
+
The gaps that turn into security defects. Fill `## Authorization` as a matrix in prose:
|
|
14
|
+
|
|
15
|
+
- Who **creates**, who **sees**, who **changes**, who **deletes**, who **decides** (an
|
|
16
|
+
action), for each kind of record.
|
|
17
|
+
- **Own, team or all**: does a manager see the requests of their team only, or of everyone
|
|
18
|
+
below them? Who is "the team" when someone changes teams?
|
|
19
|
+
- **Stand-ins**: who acts when the manager is away? Is a stand-in allowed at all?
|
|
20
|
+
- **Separation of duties**: may someone approve their own request (a manager who is also
|
|
21
|
+
an employee)?
|
|
22
|
+
- **Read-only roles**: does anyone only look (an auditor, HR, a reporting team)?
|
|
23
|
+
- What a user **without** the role sees: nothing, or a message?
|
|
24
|
+
|
|
25
|
+
## The life of a record
|
|
26
|
+
|
|
27
|
+
- The **states** a record goes through, and who or what moves it to the next one.
|
|
28
|
+
- Which steps can be **undone** (withdraw, reopen, cancel), and by whom, until when.
|
|
29
|
+
- What may still **change** in each state (nothing after approval? only the comment?).
|
|
30
|
+
- **Deadlines**: does anything happen when nobody acts (a reminder, an escalation, an
|
|
31
|
+
automatic decision)?
|
|
32
|
+
- **Deletion**: may records be deleted, or only cancelled? How long are they kept?
|
|
33
|
+
|
|
34
|
+
## The data
|
|
35
|
+
|
|
36
|
+
- Which fields are **required**, and their **limits** in business terms: "a comment of at
|
|
37
|
+
most 500 characters", "an amount with two decimals", "at most 30 days per request".
|
|
38
|
+
- **Numbers and identifiers** the users see (a request number), and whether they must be
|
|
39
|
+
without gaps.
|
|
40
|
+
- **Duplicates and overlaps**: two requests for the same days? the same customer twice?
|
|
41
|
+
- **Dates**: time zones of the users, working days or calendar days, public holidays,
|
|
42
|
+
across a year end, half days.
|
|
43
|
+
- **Money and quantities**: currency, rounding, units.
|
|
44
|
+
- **Languages**: which languages the texts and the data are in.
|
|
45
|
+
|
|
46
|
+
## Personal data
|
|
47
|
+
|
|
48
|
+
Ask whenever the feature stores data about people (employees, customers, contacts):
|
|
49
|
+
|
|
50
|
+
- Whose data is it, and who may see it (sickness as a leave type is sensitive)?
|
|
51
|
+
- How long must it be kept, and when must it be deleted or anonymized?
|
|
52
|
+
- Must changes or reads of it be traceable (who looked at what)?
|
|
53
|
+
|
|
54
|
+
Write the answers into `## Business constraints` and `## Authorization`; they become
|
|
55
|
+
data-protection decisions in Design.
|
|
56
|
+
|
|
57
|
+
## Two people at once
|
|
58
|
+
|
|
59
|
+
- Two managers decide the same request at the same moment: the first wins, and the second
|
|
60
|
+
is told?
|
|
61
|
+
- Two people edit the same record: may the second overwrite the first?
|
|
62
|
+
|
|
63
|
+
## How much, how fast
|
|
64
|
+
|
|
65
|
+
Make `## Non-functional requirements` measurable, or "none":
|
|
66
|
+
|
|
67
|
+
- How many records (now, in a year), how many users at the same time?
|
|
68
|
+
- How fast must a list or an action answer for them ("the list shows within 2 seconds
|
|
69
|
+
with 10,000 requests")?
|
|
70
|
+
- Does the list show everything, or do users always filter first (by year, by team)?
|
|
71
|
+
- Availability or working hours that matter (end of month, payroll runs)?
|
|
72
|
+
- Accessibility: must the app meet a standard (for example WCAG 2.2 level AA), and do
|
|
73
|
+
users work with a screen reader or only the keyboard? The answer is a non-functional
|
|
74
|
+
requirement with a measurable target.
|
|
75
|
+
|
|
76
|
+
## What the user is told
|
|
77
|
+
|
|
78
|
+
- After an action: a short confirmation, or a message they must read?
|
|
79
|
+
- Before an action that cannot be undone: is the user asked to confirm?
|
|
80
|
+
- When something is not allowed: which reason do they see?
|
|
81
|
+
- Who else is **informed** (the employee after a decision, by mail, in the inbox, not at
|
|
82
|
+
all)? That is a business requirement; how it is sent is Design's.
|
|
83
|
+
|
|
84
|
+
## Other systems
|
|
85
|
+
|
|
86
|
+
- Does data come from somewhere else (employees from HR, customers from the ERP), and who
|
|
87
|
+
owns it?
|
|
88
|
+
- Must something go to another system (a payroll export, an update in the ERP), and what
|
|
89
|
+
happens when that system is down?
|
|
90
|
+
|
|
91
|
+
## An AI agent in the app
|
|
92
|
+
|
|
93
|
+
Ask when the request mentions an assistant, a chat, or "the system should decide":
|
|
94
|
+
|
|
95
|
+
- What may the agent only read, and what may it do (create, approve, send)?
|
|
96
|
+
- Which actions need a person's yes before the agent runs them?
|
|
97
|
+
- Which data may it see, and may personal data be sent to an AI model at all?
|
|
98
|
+
- Who may use it, and how much (requests per user per hour)?
|
|
99
|
+
- How do we judge its answers (examples of good and bad answers become the acceptance
|
|
100
|
+
criteria; the automated tests check what it may do, not every wording)?
|
|
101
|
+
|
|
102
|
+
## Writing the acceptance criteria
|
|
103
|
+
|
|
104
|
+
- One behaviour per AC, with **concrete data**: "Given a new request of Erika for 2 to 6
|
|
105
|
+
November", not "Given a request".
|
|
106
|
+
- The **outcome is observable**: what the user sees or what is stored, not "it works".
|
|
107
|
+
- Every rule of `## Authorization` has an AC for the user who **may not** (a manager of
|
|
108
|
+
another team cannot approve), not only for the one who may.
|
|
109
|
+
- Every limit has an AC at its **edge** ("a request of 30 days is accepted; 31 days are
|
|
110
|
+
refused with the message …").
|
|
111
|
+
- Every state with a restriction has an AC for the forbidden step ("an approved request
|
|
112
|
+
cannot be approved again").
|
|
113
|
+
- Business words, not screens: "the manager approves", not "clicks the button in the
|
|
114
|
+
third column". Name what the user sees only where it matters (a message, a confirmation).
|
|
115
|
+
- `Verification: manual` only where an automated test cannot judge it (a layout, a
|
|
116
|
+
printed document).
|
|
117
|
+
|
|
118
|
+
A weak and a strong AC for the same rule:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
### LR-AC4
|
|
122
|
+
Given a request
|
|
123
|
+
When the manager approves it
|
|
124
|
+
Then it is approved
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
### LR-AC4
|
|
129
|
+
Given a new leave request of Erika (team Sales) for 2 to 6 November
|
|
130
|
+
When Mia, the manager of Sales, approves it
|
|
131
|
+
Then the request has the status Approved
|
|
132
|
+
And Mia is told that it is approved
|
|
133
|
+
And the request can no longer be approved or rejected
|
|
134
|
+
Verification: automated
|
|
135
|
+
```
|
|
@@ -8,6 +8,12 @@ description: Verify a built agjan feature. Full build, tests and lint, the basel
|
|
|
8
8
|
Prove that the feature is complete and consistent, and hand it to the human, who
|
|
9
9
|
accepts it (Gate 3, `npx agjan approve verify`).
|
|
10
10
|
|
|
11
|
+
## Arriving in auto mode
|
|
12
|
+
|
|
13
|
+
In auto mode you reach this skill from the previous one within one run, through `npx agjan skill verify`.
|
|
14
|
+
Then start step 1 at once, with a tool call: no summary of the work so far first (the user gets it
|
|
15
|
+
when the run ends, `npx agjan summary`), and no request to run `/agjan-verify`: you are running it.
|
|
16
|
+
|
|
11
17
|
## 1. Preconditions
|
|
12
18
|
|
|
13
19
|
`npx agjan status` must say `next: all tasks done and reviewed`. Otherwise stop and
|
|
@@ -121,7 +127,9 @@ Any change after the final review makes it stale; review again after the last ch
|
|
|
121
127
|
- Finish with `npx agjan status --done`. Your final message starts with its output,
|
|
122
128
|
**verbatim, in a code block**: it says that the feature is verified, what was met, and
|
|
123
129
|
the user's turn: try it, check the manual ACs by hand, and accept it in their terminal
|
|
124
|
-
with `npx agjan approve verify`.
|
|
130
|
+
with `npx agjan approve verify`. Then the output of `npx agjan summary`, verbatim, in a
|
|
131
|
+
second code block: the story of the whole work in plain words, ending with what it waits
|
|
132
|
+
for. After it, add only what the user must know that it does
|
|
125
133
|
not say (for example what you could not check yourself, a major you left open and why, or
|
|
126
134
|
an "Unverified" finding you could not settle). Then stop: never run
|
|
127
135
|
`agjan approve` yourself, also in auto mode: the acceptance is always the user's.
|
|
@@ -24,8 +24,8 @@ existing `mta.yaml` or Helm chart) win over these defaults.
|
|
|
24
24
|
|
|
25
25
|
| The task touches | Read |
|
|
26
26
|
|---|---|
|
|
27
|
-
| runtime, `mta.yaml`, Helm, database, `cds add
|
|
28
|
-
| `xs-security.json`, roles,
|
|
27
|
+
| runtime, `mta.yaml`, Helm, database, what the production build contains, serving the UIs, which `cds add` facet, updates without downtime, health, logging | `references/deployment.md` |
|
|
28
|
+
| IAS or XSUAA, `xs-security.json`, roles, redirect URIs, app router, destinations, secrets | `references/security.md` |
|
|
29
29
|
|
|
30
30
|
## Decide in this order
|
|
31
31
|
|
|
@@ -40,6 +40,11 @@ existing `mta.yaml` or Helm chart) win over these defaults.
|
|
|
40
40
|
4. **Security follows the model.** Roles come from the service's `@requires` and
|
|
41
41
|
`@restrict`; `xs-security.json` is derived from them, never the other way round.
|
|
42
42
|
5. **Secrets never go into files** in the repository; they come from service bindings.
|
|
43
|
+
6. **Every app and every data change has a way to production.** A design with a Fiori
|
|
44
|
+
app says how it is served (it is not in `cds build`); a model change that renames or
|
|
45
|
+
deletes persisted data says how the data moves; demo rows never reach `db/data`.
|
|
46
|
+
7. **Identity:** IAS with AMS for new projects (CAP's recommendation), XSUAA where the
|
|
47
|
+
project already uses it; switching is a decision of its own.
|
|
43
48
|
|
|
44
49
|
## Building
|
|
45
50
|
|
|
@@ -35,6 +35,31 @@ CC-BY-4.0), on 2026-10-17. Rules restated; check details with `search_docs`.
|
|
|
35
35
|
change before committing.
|
|
36
36
|
- Keep `package-lock.json` current (`npm install --package-lock-only`) so the build
|
|
37
37
|
installs what was tested.
|
|
38
|
+
- Updates without downtime: `cf deploy <mtar> --strategy blue-green` (the MultiApps CLI
|
|
39
|
+
plugin) runs the new version next to the old and switches routes after checks; confirm
|
|
40
|
+
the options for the landscape. Database changes deploy first and must work with both
|
|
41
|
+
versions while they run side by side (cap-developer `modeling.md`, changing a deployed
|
|
42
|
+
model).
|
|
43
|
+
|
|
44
|
+
## What a production build contains (checked with cds-dk 10.1)
|
|
45
|
+
|
|
46
|
+
- `cds build --production` writes `gen/srv` (the compiled service, its `package.json`) and
|
|
47
|
+
`gen/db` (the HDI artifacts). Check it before committing a deployment change.
|
|
48
|
+
- **The Fiori apps are not in it.** `cds watch` serves them through `cds-plugin-ui5`, a
|
|
49
|
+
development dependency; in production nothing serves `app/` unless the design decides how:
|
|
50
|
+
the HTML5 Application Repository (`cds add html5-repo`) with SAP Build Work Zone
|
|
51
|
+
(`cds add workzone-standard`) for a launchpad, or the Application Frontend service
|
|
52
|
+
(`cds add app-frontend`). A design with a Fiori app and a btp area names one.
|
|
53
|
+
- `gen/db` contains `.hdbtabledata` only for `db/data` (test rows in `test/data` stay out),
|
|
54
|
+
the `cds.outbox.Messages` table of the persistent queue, and an `undeploy.json` that lets
|
|
55
|
+
HDI remove views and draft tables. Never add tables to `undeploy.json` (their data is
|
|
56
|
+
dropped).
|
|
57
|
+
- Every TypeScript file that `tsconfig.cdsbuild.json` does not exclude is compiled into
|
|
58
|
+
`gen/srv` and deployed (tests, a `playwright.config.ts`): exclude them (cap-developer
|
|
59
|
+
`typescript.md`).
|
|
60
|
+
- `cds add mta` builds with `npm ci` and `cds build --production`, deploys modules in
|
|
61
|
+
parallel, and gives the service 1 instance; memory, instances and per-landscape values
|
|
62
|
+
belong in an `.mtaext` per landscape, not in the base `mta.yaml`.
|
|
38
63
|
|
|
39
64
|
## Kyma
|
|
40
65
|
|
|
@@ -61,6 +86,24 @@ CC-BY-4.0), on 2026-10-17. Rules restated; check details with `search_docs`.
|
|
|
61
86
|
and extensibility fundamentally: decide it at the start of a project, never as a side
|
|
62
87
|
effect of a feature.
|
|
63
88
|
|
|
89
|
+
## Choosing what to add
|
|
90
|
+
|
|
91
|
+
`cds add` (cds-dk 10.1) has a facet for each BTP service a CAP app commonly needs; each is a
|
|
92
|
+
decision with its plan and cost, never a side effect:
|
|
93
|
+
|
|
94
|
+
| Need | Facet |
|
|
95
|
+
|---|---|
|
|
96
|
+
| login and roles | `ias` with `ams` (new projects), `xsuaa` (existing) |
|
|
97
|
+
| database | `hana`, `hana-serverless`, `postgres` |
|
|
98
|
+
| UI hosting and launchpad | `html5-repo`, `workzone-standard`, `app-frontend`, `approuter` |
|
|
99
|
+
| remote systems | `destination`, `connectivity` (on-premise through the Cloud Connector) |
|
|
100
|
+
| events between apps | `event-mesh`, `enterprise-messaging`, `kafka`, `redis-messaging` |
|
|
101
|
+
| personal data, logs, telemetry | `audit-logging`, `application-logging`, `cloud-logging` |
|
|
102
|
+
| files | `attachments` (Object Store), `malware-scanner` |
|
|
103
|
+
| an AI agent or other LLM use | `ai` (SAP AI Core, adds `@cap-js/ai`); the agent itself is `@cap-js/agents` (cap-developer `agents.md`) |
|
|
104
|
+
| notifications to users | `notifications` |
|
|
105
|
+
| CI/CD | `github-actions`, `pipeline` |
|
|
106
|
+
|
|
64
107
|
## Operations
|
|
65
108
|
|
|
66
109
|
- The Node.js runtime answers `/health` with `{ status: 'UP' }` for liveness and readiness
|
|
@@ -4,7 +4,50 @@ Distilled from the CAP documentation (capire, Apache-2.0), retrieved through the
|
|
|
4
4
|
server, and from the SAP BTP documentation (`SAP-docs/btp-cloud-platform`, CC-BY-4.0),
|
|
5
5
|
on 2026-10-17. Rules restated; check details with `search_docs`.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Choosing the identity service
|
|
8
|
+
|
|
9
|
+
Authentication is a design decision, and for a project already on XSUAA it stays XSUAA:
|
|
10
|
+
|
|
11
|
+
- **New projects: SAP Cloud Identity Services (IAS)**, as CAP's documentation now
|
|
12
|
+
recommends ("Start new projects with IAS"): `cds add ias` for authentication, and
|
|
13
|
+
`cds add ams` for roles through the Authorization Management Service (below). IAS also propagates users across landscapes, which XSUAA does
|
|
14
|
+
not do out of the box. Production uses `"auth": { "kind": "ias" }`.
|
|
15
|
+
- **XSUAA** (`cds add xsuaa`, below) where the project, the subaccount's role collections
|
|
16
|
+
or the customer's landscape already use it. IAS can consume XSUAA-protected services.
|
|
17
|
+
- Either way the model's roles are the source; the descriptor or the policies are derived.
|
|
18
|
+
- Confirm the current setup steps with `search_docs` ("Adding IAS", "Adding AMS Support");
|
|
19
|
+
they changed in recent CAP releases.
|
|
20
|
+
|
|
21
|
+
## Authorization with AMS (checked with @sap/ams 3.10 and @sap/cds 10.1)
|
|
22
|
+
|
|
23
|
+
Tried on a copy of the example with the setup of SAP's `ams-samples-node` (Apache-2.0):
|
|
24
|
+
|
|
25
|
+
- `cds add ams` (it adds `ias` too) adds `@sap/ams`, `@sap/xssec` and the dev plugin
|
|
26
|
+
`@sap/ams-dev`, and sets `"[production]": { "auth": "ias" }`. It rewrites the whole
|
|
27
|
+
`package.json`; review the diff.
|
|
28
|
+
- **The roles stay in the model** (`@requires`, `@restrict`). `cds build --for ams` writes
|
|
29
|
+
`ams/dcl/cap/basePolicies.dcl`, one policy per role (`POLICY "manager" { ASSIGN ROLE
|
|
30
|
+
"manager"; }`), and `ams/dcl/schema.dcl`. Commit the `ams/` folder; administrators
|
|
31
|
+
assign the policies to users in the Identity Service, at runtime and without a
|
|
32
|
+
deployment (role changes are cached for 15 seconds in the sample).
|
|
33
|
+
- **Attributes** let administrators narrow a role per user without code:
|
|
34
|
+
`annotate LeaveService.LeaveRequests with @ams.attributes: { Team: (employee.team.name) };`
|
|
35
|
+
puts `Team: String` into the schema. Write the base policy so it can be restricted,
|
|
36
|
+
`ASSIGN ROLE "manager" WHERE Team IS NOT RESTRICTED;`, and a restricting policy uses it:
|
|
37
|
+
`POLICY SalesManager { USE cap.manager RESTRICT Team IN ('Sales'); }`. Once you edit a
|
|
38
|
+
generated file and remove its generated header, the build keeps it.
|
|
39
|
+
- The attribute filter **adds to** the model's `where`: the team's manager saw 2 requests
|
|
40
|
+
with `cap.manager` and with Sales only, and 0 with Support only. AMS narrows, it never
|
|
41
|
+
opens what `@restrict` closes.
|
|
42
|
+
- **Local and test users** get policies instead of roles,
|
|
43
|
+
`"manager": { "password": "manager", "policies": ["cap.manager"] }`; policies for tests
|
|
44
|
+
only go to `ams/dcl/local/` (the sample's convention). Users with `roles` keep working.
|
|
45
|
+
Technical users and calls from other apps use `ias_apis` with API policies, which
|
|
46
|
+
narrow the user's policies further (principal propagation in the sample).
|
|
47
|
+
- Each policy, attribute and assignment rule is an authorization decision of the design;
|
|
48
|
+
`ams/**` is a risk path in agjan, like `xs-security.json`.
|
|
49
|
+
|
|
50
|
+
## Authentication and the security descriptor (XSUAA)
|
|
8
51
|
|
|
9
52
|
- `cds add xsuaa` configures XSUAA authentication (`"auth": "xsuaa"`, with `@sap/xssec`)
|
|
10
53
|
and generates `xs-security.json` from the model:
|
|
@@ -22,12 +65,24 @@ on 2026-10-17. Rules restated; check details with `search_docs`.
|
|
|
22
65
|
common subset works for both.) Attributes used as `$user.<attribute>`: letters, digits
|
|
23
66
|
and `_`, at most 64 characters. Role collection names: at most 64 characters.
|
|
24
67
|
- Role collections, which group role templates and are assigned to users, are normally
|
|
25
|
-
created by administrators in the BTP cockpit. Predefine them
|
|
26
|
-
|
|
27
|
-
|
|
68
|
+
created by administrators in the BTP cockpit. Predefine them only for templates without
|
|
69
|
+
attributes. The design names who assigns which collection.
|
|
70
|
+
- What `cds add xsuaa,mta` writes (cds-dk 10.1, checked 2026-10-21) and why it matters:
|
|
71
|
+
- `xs-security.json` holds the scopes and role templates; `mta.yaml` adds the instance
|
|
72
|
+
`config`: `xsappname: <app>-${org}-${space}` (one per space, so dev and prod do not
|
|
73
|
+
collide), `tenant-mode: dedicated`, `credential-types: [binding-secret, x509]`, and the
|
|
74
|
+
role collections named `<role> (<app> ${org}-${space})`.
|
|
75
|
+
- `oauth2-configuration.redirect-uris: [https://*~{app-api/app-uri}/**]`: XSUAA redirects
|
|
76
|
+
a login only to listed URLs. Keep the entry when editing, and add every other host the
|
|
77
|
+
app is reached by (a custom domain), or the login fails with a redirect error.
|
|
78
|
+
- `[production]: { auth: 'xsuaa' }` in `package.json`, `@sap/xssec` as a dependency.
|
|
28
79
|
|
|
29
80
|
## App router
|
|
30
81
|
|
|
82
|
+
- `cds add approuter` (cds-dk 10.1) writes `.deploy/app-router/` with an `xs-app.json`
|
|
83
|
+
that forwards everything to the service destination `srv-api` with
|
|
84
|
+
`"csrfProtection": true` and the user's token (`forwardAuthToken: true` in `mta.yaml`).
|
|
85
|
+
Keep CSRF protection on for every route that changes data.
|
|
31
86
|
- `cds add approuter` adds the SAP application router, which serves the UIs, runs the
|
|
32
87
|
interactive login against XSUAA and forwards requests with the user's token. Routes
|
|
33
88
|
live in `xs-app.json`. It is only needed for deployment; keep it out of the app folders
|
|
@@ -23,12 +23,13 @@ Rules for designing and building CAP Node.js backends in agjan. Project conventi
|
|
|
23
23
|
|
|
24
24
|
| The task touches | Read |
|
|
25
25
|
|---|---|
|
|
26
|
-
| a new project, the layout, configuration, development users, sample data, running it | `references/project-setup.md` |
|
|
26
|
+
| a new project, the layout, configuration, development users, sample and test data, running it | `references/project-setup.md` |
|
|
27
27
|
| TypeScript: setup, generated types, typed handlers, tests, build (the default language) | `references/typescript.md` |
|
|
28
|
-
| entities, types, associations, compositions, localized texts | `references/modeling.md` |
|
|
29
|
-
|
|
|
30
|
-
| input
|
|
31
|
-
|
|
|
28
|
+
| entities, types (money, dates, lengths), associations, compositions, localized texts, changing a deployed model | `references/modeling.md` |
|
|
29
|
+
| an AI agent in the app (`@cap-js/agents`: `@agent`, the LLM per profile, `AGENTS.md` next to a service, human approval, masking) | `references/agents.md` |
|
|
30
|
+
| services, projections, actions, functions, status-transition flows, drafts, read-only input, concurrent changes, value help, remote services and their local mocks, other protocols (`@rest`, `@mcp`) | `references/services.md` |
|
|
31
|
+
| input validation, `@mandatory`, `@assert…`, authorization, error messages, personal data | `references/validation-security.md` |
|
|
32
|
+
| handler code, queries, errors, messages to the user, performance, queued calls, transactions | `references/handlers.md` |
|
|
32
33
|
| tests | `references/testing.md` |
|
|
33
34
|
|
|
34
35
|
## Decide in this order
|
|
@@ -41,7 +42,8 @@ Rules for designing and building CAP Node.js backends in agjan. Project conventi
|
|
|
41
42
|
convert it on your own (`references/typescript.md`).
|
|
42
43
|
|
|
43
44
|
1. **Declarative before code.** What an annotation can express (validation, read-only,
|
|
44
|
-
authorization, defaults) is never written as
|
|
45
|
+
authorization, defaults, status transitions with `@flow.status`) is never written as
|
|
46
|
+
handler code.
|
|
45
47
|
2. **Extend before adding.** A new service, entity or BTP-relevant dependency is a
|
|
46
48
|
design decision with reason and alternative; prefer extending what exists.
|
|
47
49
|
3. **The domain model stays clean; services are facades.** Persistence in `db/`;
|
|
@@ -49,7 +51,13 @@ Rules for designing and building CAP Node.js backends in agjan. Project conventi
|
|
|
49
51
|
4. **Authorization is part of the design**, named after the spec's business roles, and a
|
|
50
52
|
risk whenever it changes.
|
|
51
53
|
5. **Compatibility.** Removing or renaming an element of an exposed entity breaks
|
|
52
|
-
clients (UIs, other services)
|
|
54
|
+
clients (UIs, other services), and on a deployed SAP HANA database a rename drops the
|
|
55
|
+
column's data (`references/modeling.md`); call it out under Risks.
|
|
56
|
+
6. **Design for production, not for the demo.** For every entity the feature touches,
|
|
57
|
+
decide and write down: how many rows (paging, no queries in loops), who changes it at
|
|
58
|
+
the same time (draft lock or `@odata.etag`), which fields only the server sets
|
|
59
|
+
(`@readonly`, `@Core.Immutable`), and whether it holds personal data (`@PersonalData`,
|
|
60
|
+
audit logging). Demo rows go to `test/data`, never `db/data`.
|
|
53
61
|
|
|
54
62
|
## Building
|
|
55
63
|
|
|
@@ -57,5 +65,9 @@ Rules for designing and building CAP Node.js backends in agjan. Project conventi
|
|
|
57
65
|
`.js` in a JavaScript project).
|
|
58
66
|
- In TypeScript, `npm run typecheck` (cds-typer, then `tsc --noEmit`) must pass with the
|
|
59
67
|
tests.
|
|
68
|
+
- Where the project has `eslint.config.mjs`, `npx cds lint` must pass after a model change
|
|
69
|
+
(CAP's model and authorization rules, `references/project-setup.md`).
|
|
70
|
+
- One concern per file, as the layout says (`references/project-setup.md`): constraints,
|
|
71
|
+
flows and each app's annotations next to the service, not inside it.
|
|
60
72
|
- Write a test for each AC of the task, named with the AC id, through the service API.
|
|
61
73
|
- Run the area's test command, then `npx agjan check`, before you commit the task.
|