@tera-system/core 0.2.19 → 0.3.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 (35) hide show
  1. package/MANIFEST.json +6 -6
  2. package/RELEASES.md +28 -0
  3. package/agents/auditor.md +17 -0
  4. package/agents/design-reviewer.md +12 -3
  5. package/agents/tera.md +48 -76
  6. package/agents/ui-designer.md +31 -0
  7. package/commands/tera-approve.md +34 -34
  8. package/commands/tera-diagnose.md +47 -47
  9. package/commands/tera-gate.md +40 -40
  10. package/commands/tera-help.md +41 -41
  11. package/commands/tera-new-project.md +35 -35
  12. package/commands/tera-plan.md +34 -34
  13. package/commands/tera-request-build.md +45 -45
  14. package/commands/tera-resume.md +34 -34
  15. package/commands/tera-review.md +52 -52
  16. package/commands/tera-status.md +38 -38
  17. package/commands/tera-update.md +48 -48
  18. package/core/tera-system/AGENT_ACTIVATION_MATRIX.md +2 -0
  19. package/core/tera-system/AGENT_DEPENDENCY_MAP.md +4 -4
  20. package/core/tera-system/TOOLING_AND_MCP_POLICY.md +81 -1
  21. package/core/tera-system/TeraArchitectureMap.md +3 -0
  22. package/core/tera-system/TeraCapabilityMap.md +4 -4
  23. package/core/tera-system/TeraPolicyMap.md +3 -1
  24. package/core/tera-system/image-generation/ASSET_POLICY.md +149 -0
  25. package/core/tera-system/image-generation/IMAGE_TOOL_CONTRACT.md +341 -0
  26. package/core/tera-system/profiles/PROFILES_INDEX.md +1 -0
  27. package/core/tera-system/profiles/node-ts-coolify-postgres.md +93 -0
  28. package/core/tera-system/profiles/rust.md +164 -0
  29. package/core/tera-system/runtime/TERA_RUNTIME_PROTOCOLS.md +1 -1
  30. package/core/tera-system/runtime/TERA_RUNTIME_TEMPLATES.md +5 -4
  31. package/core/tera-system/runtime/TERA_RUNTIME_TEMPLATES_DELIVERY.md +59 -0
  32. package/core/tera-system/semgrep-rules/tera-security.yml +119 -10
  33. package/package.json +2 -2
  34. package/scripts/install.js +20 -15
  35. package/scripts/tera-license.mjs +0 -63
@@ -154,6 +154,8 @@ The generated file is saved to `project-control/EXECUTION_BATCH_PLAN.md`.
154
154
  | TASK-COD-002 | [e.g. Init ORM + DB] | EngineeringAgent | `prisma/schema.prisma`, `.env.example` | PASS |
155
155
  | ... | ... | ... | ... | ... |
156
156
 
157
+ > **قاعدة قياسية لكل مهمة (GAP-013):** إن احتاج الوكيل أداة خارج صلاحياته → توقف + اطلبها من Tera — لا يُكمل بأدلة ناقصة صامتة، ولا يرحّل الفجوة للمالك. (راجع `TERA_RUNTIME_TEMPLATES.md` §2 — Tool Escalation)
158
+
157
159
  ## 3. Not Included (Deferred to Later Batches)
158
160
 
159
161
  | Item | Reason | Expected Batch |
@@ -585,3 +587,60 @@ clients/CLIENT-[client-name-or-id]/applications/APP-[app-name-or-id]/delivery/CL
585
587
  - سجّل نتيجة الاختبار (تاريخ، نجاح/فشل) في وثائق التسليم.
586
588
 
587
589
  ---
590
+
591
+ ## 39. TERA Audit Trail Entry Template (moved from tera.md §26 — SCP-2026-09-16-004)
592
+
593
+ Operational core stays in `tera.md` §26 (file, sole owner, when in brief, minimum fields, closure gate). This section holds the full record-once reference: event list + entry structure + evidence guidance.
594
+
595
+ ### 39.1 When to Record (substantive events only)
596
+
597
+ Record an entry only at these events:
598
+ 1. Phase start
599
+ 2. Phase end
600
+ 3. Gate PASS / FAIL
601
+ 4. Execution Plan / Batch Plan created or approved
602
+ 5. `TASK-COD-*` created
603
+ 6. Task delegated to an agent
604
+ 7. Handback received from an agent
605
+ 8. Handback rejected / rework requested
606
+ 9. QA / Auditor / Reviewer invoked
607
+ 10. QA / Audit / Review result that affects a decision
608
+ 11. Owner decision or clarification that affects execution
609
+ 12. Open Item status change
610
+ 13. Scope Change Request
611
+ 14. Governance violation discovered
612
+ 15. Dependency or batch-order change
613
+ 16. TASK closed
614
+ 17. Batch accepted or rejected
615
+ 18. Phase 5 → 6 transition
616
+ 19. Phase 6 → 7 transition
617
+ 20. Final delivery / closure
618
+
619
+ Do **NOT** record: every file read, grep, shell command, internal message, minor failed attempt, small bug fix, or line edit. Record only events with value for governance, delegation, decision-making, quality, traceability, phase control, scope control, or accountability.
620
+
621
+ ### 39.2 Entry Structure
622
+
623
+ Fields (not all mandatory for every event):
624
+ - Audit ID (`AUD-0001`, `AUD-0002`, … — sequential, zero-padded, one format only)
625
+ - Timestamp
626
+ - Phase
627
+ - Event Type
628
+ - Actor
629
+ - Target
630
+ - Related Task / Batch
631
+ - Source of Truth
632
+ - Action Taken
633
+ - Decision
634
+ - Reason
635
+ - Evidence
636
+ - Gate Result
637
+ - Owner Approval Required
638
+ - Owner Approval Status
639
+ - Next Step
640
+
641
+ **Mandatory minimum per entry:** Audit ID, Timestamp, Phase, Event Type, Actor, Action Taken, Evidence (or Reference), Next Step. Never write an entry without these.
642
+
643
+ ### 39.3 Evidence
644
+
645
+ Point to real evidence wherever possible — never just "done successfully":
646
+ - file path, `TASK-ID`, `Batch-ID`, commit SHA, QA report, handback file, decision-log entry, gate-result file.
@@ -1,13 +1,52 @@
1
1
  rules:
2
- - id: tera-no-hardcoded-secrets
2
+ - id: tera-no-hardcoded-secrets-csharp
3
3
  message: >
4
4
  SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو ConnectionStrings أو Secrets في الكود.
5
5
  استخدم User Secrets / Environment Variables / Azure Key Vault / أي آلية آمنة معتمدة.
6
6
  severity: ERROR
7
7
  languages:
8
8
  - csharp
9
+ patterns:
10
+ - pattern: |
11
+ $VAR = "..."
12
+ - metavariable-regex:
13
+ metavariable: $VAR
14
+ regex: (?i).*(password|secret|connection.?string|api.?key|apikey|passwd|pwd|credential).*
15
+
16
+ - id: tera-no-hardcoded-secrets-javascript
17
+ message: >
18
+ SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو ConnectionStrings أو Secrets في الكود.
19
+ استخدم User Secrets / Environment Variables / Azure Key Vault / أي آلية آمنة معتمدة.
20
+ severity: ERROR
21
+ languages:
9
22
  - javascript
23
+ patterns:
24
+ - pattern: |
25
+ $VAR = "..."
26
+ - metavariable-regex:
27
+ metavariable: $VAR
28
+ regex: (?i).*(password|secret|connection.?string|api.?key|apikey|passwd|pwd|credential).*
29
+
30
+ - id: tera-no-hardcoded-secrets-typescript
31
+ message: >
32
+ SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو ConnectionStrings أو Secrets في الكود.
33
+ استخدم User Secrets / Environment Variables / Azure Key Vault / أي آلية آمنة معتمدة.
34
+ severity: ERROR
35
+ languages:
10
36
  - typescript
37
+ patterns:
38
+ - pattern: |
39
+ $VAR = "..."
40
+ - metavariable-regex:
41
+ metavariable: $VAR
42
+ regex: (?i).*(password|secret|connection.?string|api.?key|apikey|passwd|pwd|credential).*
43
+
44
+ - id: tera-no-hardcoded-secrets-python
45
+ message: >
46
+ SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو ConnectionStrings أو Secrets في الكود.
47
+ استخدم User Secrets / Environment Variables / Azure Key Vault / أي آلية آمنة معتمدة.
48
+ severity: ERROR
49
+ languages:
11
50
  - python
12
51
  patterns:
13
52
  - pattern: |
@@ -16,6 +55,23 @@ rules:
16
55
  metavariable: $VAR
17
56
  regex: (?i).*(password|secret|connection.?string|api.?key|apikey|passwd|pwd|credential).*
18
57
 
58
+ - id: tera-no-hardcoded-secrets-kotlin
59
+ message: >
60
+ SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو ConnectionStrings أو Secrets في الكود.
61
+ استخدم User Secrets / Environment Variables / Azure Key Vault / أي آلية آمنة معتمدة.
62
+ severity: ERROR
63
+ languages:
64
+ - kotlin
65
+ patterns:
66
+ - pattern-either:
67
+ - pattern: |
68
+ val $VAR = "..."
69
+ - pattern: |
70
+ var $VAR = "..."
71
+ - metavariable-regex:
72
+ metavariable: $VAR
73
+ regex: (?i).*(password|secret|connection.?string|api.?key|apikey|passwd|pwd|credential).*
74
+
19
75
  - id: tera-no-eval
20
76
  pattern: eval(...)
21
77
  message: >
@@ -44,23 +100,76 @@ rules:
44
100
  metavariable: $VAR
45
101
  regex: (?i).*
46
102
 
47
- - id: tera-exposed-credentials
103
+ - id: tera-exposed-credentials-csharp
48
104
  message: >
49
105
  SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو توكنز أو API Keys بشكل صريح في الكود.
50
106
  severity: ERROR
51
107
  languages:
52
108
  - csharp
109
+ patterns:
110
+ - pattern: $VAR = $VAL
111
+ - metavariable-regex:
112
+ metavariable: $VAL
113
+ regex: ^"(sk-|ghp_|AKIA|=).*"
114
+
115
+ - id: tera-exposed-credentials-javascript
116
+ message: >
117
+ SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو توكنز أو API Keys بشكل صريح في الكود.
118
+ severity: ERROR
119
+ languages:
53
120
  - javascript
121
+ patterns:
122
+ - pattern: $VAR = $VAL
123
+ - metavariable-regex:
124
+ metavariable: $VAL
125
+ regex: ^"(sk-|ghp_|AKIA|=).*"
126
+
127
+ - id: tera-exposed-credentials-typescript
128
+ message: >
129
+ SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو توكنز أو API Keys بشكل صريح في الكود.
130
+ severity: ERROR
131
+ languages:
54
132
  - typescript
133
+ patterns:
134
+ - pattern: $VAR = $VAL
135
+ - metavariable-regex:
136
+ metavariable: $VAL
137
+ regex: ^"(sk-|ghp_|AKIA|=).*"
138
+
139
+ - id: tera-exposed-credentials-python
140
+ message: >
141
+ SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو توكنز أو API Keys بشكل صريح في الكود.
142
+ severity: ERROR
143
+ languages:
55
144
  - python
145
+ patterns:
146
+ - pattern: $VAR = $VAL
147
+ - metavariable-regex:
148
+ metavariable: $VAL
149
+ regex: ^"(sk-|ghp_|AKIA|=).*"
150
+
151
+ - id: tera-exposed-credentials-java
152
+ message: >
153
+ SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو توكنز أو API Keys بشكل صريح في الكود.
154
+ severity: ERROR
155
+ languages:
56
156
  - java
157
+ patterns:
158
+ - pattern: $VAR = $VAL
159
+ - metavariable-regex:
160
+ metavariable: $VAL
161
+ regex: ^"(sk-|ghp_|AKIA|=).*"
162
+
163
+ - id: tera-exposed-credentials-kotlin
164
+ message: >
165
+ SECURITY [QG-SEC-001]: لا تخزن مفاتيح أو توكنز أو API Keys بشكل صريح في الكود.
166
+ severity: ERROR
167
+ languages:
168
+ - kotlin
57
169
  patterns:
58
170
  - pattern-either:
59
- - pattern: |
60
- $VAR = "=...="
61
- - pattern: |
62
- $VAR = "sk-..."
63
- - pattern: |
64
- $VAR = "ghp_..."
65
- - pattern: |
66
- $VAR = "AKIA..."
171
+ - pattern: val $VAR = $VAL
172
+ - pattern: var $VAR = $VAL
173
+ - metavariable-regex:
174
+ metavariable: $VAL
175
+ regex: ^"(sk-|ghp_|AKIA|=).*"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tera-system/core",
3
- "version": "0.2.19",
4
- "description": "Tera System OpenCode Plugin ط£آ¢أ¢â€ڑآ¬أ¢â‚¬â€Œ governance core, 20 agents, 11 commands, distribution tools (personal edition)",
3
+ "version": "0.3.0",
4
+ "description": "Tera System OpenCode Plugin — governance core, 23 agents, 11 commands, distribution tools (personal edition)",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
7
7
  "engines": {
@@ -226,21 +226,26 @@ fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
226
226
  fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
227
227
 
228
228
  /* ------------------- license state (non-blocking, never breaks install) ------------------- */
229
- try {
230
- const stateFile = path.join(target, ".tera", "license.state.json");
231
- let licenseKey = (readLicenseState(stateFile) || {}).licenseKey;
232
- if (!licenseKey) licenseKey = process.env.TERA_LICENSE_KEY || undefined;
233
- const state = assessLicenseState(licenseKey);
234
- writeLicenseState(stateFile, {
235
- state: state.state,
236
- reason: state.reason,
237
- licenseKey: licenseKey || null,
238
- expiresAt: state.expiresAt || null,
239
- checkedAt: new Date().toISOString(),
240
- });
241
- console.log(` [license ] state=${state.state} (${state.reason})`);
242
- } catch (err) {
243
- console.log(` [license ] skipped (${err.message}) — install continues`);
229
+ // `@tera-system/core` is free — it has no license gate. Skip the whole block for it so no
230
+ // `[license]` line is printed and no `.tera/license.state.json` is ever created.
231
+ // The paid `@tera-system/pro` distribution keeps its own license flow via its install.js.
232
+ if (pkg.name !== "@tera-system/core") {
233
+ try {
234
+ const stateFile = path.join(target, ".tera", "license.state.json");
235
+ let licenseKey = (readLicenseState(stateFile) || {}).licenseKey;
236
+ if (!licenseKey) licenseKey = process.env.TERA_LICENSE_KEY || undefined;
237
+ const state = assessLicenseState(licenseKey);
238
+ writeLicenseState(stateFile, {
239
+ state: state.state,
240
+ reason: state.reason,
241
+ licenseKey: licenseKey || null,
242
+ expiresAt: state.expiresAt || null,
243
+ checkedAt: new Date().toISOString(),
244
+ });
245
+ console.log(` [license ] state=${state.state} (${state.reason})`);
246
+ } catch (err) {
247
+ console.log(` [license ] skipped (${err.message}) — install continues`);
248
+ }
244
249
  }
245
250
 
246
251
  console.log("\n summary:");
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env node
2
- // @tera/core license CLI — issue & verify license keys (SCP-005)
3
- import fs from "node:fs";
4
- import path from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- import { issueLicenseKey, assessLicenseState, readLicenseState, STATES } from "./lib/license.mjs";
7
-
8
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
- const DEV_KEY = path.join(__dirname, "..", "license", "dev", "dev-private-key.pem");
10
-
11
- function usage() {
12
- console.log(`Usage:
13
- tera-license gen --tier <basic|premium> --project <name> --expires <YYYY-MM-DD> [--seats N]
14
- (private key: env TERA_LICENSE_PRIVATE or the dev key under license/dev/)
15
- tera-license check [--key <licenseKey> | --state-file <path>]
16
- (or env TERA_LICENSE_KEY)`);
17
- }
18
-
19
- const args = process.argv.slice(2);
20
- const cmd = args[0];
21
- function flag(name) {
22
- const i = args.indexOf(name);
23
- return i >= 0 && args[i + 1] ? args[i + 1] : undefined;
24
- }
25
-
26
- if (cmd === "gen") {
27
- const tier = flag("--tier") || "basic";
28
- const project = flag("--project");
29
- const expires = flag("--expires");
30
- const seats = flag("--seats") ? Number(flag("--seats")) : 1;
31
- if (!project || !expires) {
32
- usage();
33
- process.exit(1);
34
- }
35
- const privatePem = process.env.TERA_LICENSE_PRIVATE || fs.readFileSync(DEV_KEY, "utf8");
36
- const key = issueLicenseKey(
37
- { tier, project, issuedAt: new Date().toISOString(), expiresAt: new Date(expires).toISOString(), seats },
38
- privatePem
39
- );
40
- console.log(key);
41
- } else if (cmd === "check") {
42
- let key = flag("--key");
43
- if (!key) {
44
- const stateFile = flag("--state-file");
45
- if (stateFile) {
46
- const st = readLicenseState(stateFile);
47
- key = st && st.licenseKey;
48
- if (!key) {
49
- console.log(JSON.stringify({ state: STATES.UNLICENSED, reason: "no-key-trial" }, null, 2));
50
- process.exit(0);
51
- }
52
- } else {
53
- key = process.env.TERA_LICENSE_KEY;
54
- }
55
- }
56
- if (!key) {
57
- console.log(JSON.stringify({ state: STATES.UNLICENSED, reason: "no-key-trial" }, null, 2));
58
- process.exit(0);
59
- }
60
- console.log(JSON.stringify(assessLicenseState(key), null, 2));
61
- } else {
62
- usage();
63
- }