pakem-cli 0.0.0-stage → 1.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 (76) hide show
  1. package/CHANGELOG.md +280 -0
  2. package/LICENSE +21 -0
  3. package/README-ID.md +666 -0
  4. package/README.md +665 -2
  5. package/SKILL.md +264 -0
  6. package/adapters/git-worktree/v1/README.md +17 -0
  7. package/adapters/identity/v1/README.md +26 -0
  8. package/adapters/mcp/v1/README.md +56 -0
  9. package/adapters/storage-sqlite/v1/README.md +5 -0
  10. package/assets/banner.svg +275 -0
  11. package/assets/divider.svg +82 -0
  12. package/assets/footer.svg +174 -0
  13. package/assets/templates/BUG-HISTORY.md +18 -0
  14. package/assets/templates/CONTEXT.md +26 -0
  15. package/assets/templates/DECISIONS.md +8 -0
  16. package/assets/templates/MODULE-MAP.md +14 -0
  17. package/assets/templates/POLICY.json +15 -0
  18. package/assets/templates/PROJECT.md +42 -0
  19. package/conformance/v1/README.md +15 -0
  20. package/coordination/v1/README.md +14 -0
  21. package/coordination/v1/board.schema.json +59 -0
  22. package/coordination/v1/event.schema.json +26 -0
  23. package/coordination/v1/status.schema.json +49 -0
  24. package/evals/README.md +63 -0
  25. package/evals/evals.json +276 -0
  26. package/identity/v1/README.md +14 -0
  27. package/identity/v1/agent-identity.schema.json +95 -0
  28. package/identity/v1/identity-registry.schema.json +29 -0
  29. package/identity/v1/signed-payload.schema.json +42 -0
  30. package/intelligence/v1/README.md +19 -0
  31. package/intelligence/v1/dependency-graph.schema.json +82 -0
  32. package/intelligence/v1/impact-analysis.schema.json +51 -0
  33. package/intelligence/v1/reconciliation.schema.json +156 -0
  34. package/npm/bin/pakem.js +272 -0
  35. package/npm/check-version.js +26 -0
  36. package/package.json +58 -4
  37. package/policy/v1/README.md +15 -0
  38. package/policy/v1/policy.schema.json +20 -0
  39. package/protocol/v1/README.md +68 -0
  40. package/protocol/v1/capabilities.schema.json +17 -0
  41. package/protocol/v1/event.schema.json +114 -0
  42. package/protocol/v1/session.schema.json +51 -0
  43. package/references/artifacts.md +96 -0
  44. package/references/conventions.md +83 -0
  45. package/references/reviews.md +44 -0
  46. package/runtime/v1/README.md +21 -0
  47. package/runtime/v1/approval.schema.json +100 -0
  48. package/runtime/v1/checkpoint.schema.json +17 -0
  49. package/runtime/v1/hook-decision.schema.json +34 -0
  50. package/runtime/v1/hook-payload.schema.json +12 -0
  51. package/runtime/v1/task-evidence.schema.json +38 -0
  52. package/runtime/v1/work-report.schema.json +123 -0
  53. package/runtime/v1/workflow.schema.json +21 -0
  54. package/scripts/__pycache__/pakem.cpython-312.pyc +0 -0
  55. package/scripts/pakem.py +4911 -0
  56. package/scripts/pakem_core/__init__.py +3 -0
  57. package/scripts/pakem_core/__pycache__/__init__.cpython-312.pyc +0 -0
  58. package/scripts/pakem_core/__pycache__/coordination.cpython-312.pyc +0 -0
  59. package/scripts/pakem_core/__pycache__/git_worktree.cpython-312.pyc +0 -0
  60. package/scripts/pakem_core/__pycache__/identity.cpython-312.pyc +0 -0
  61. package/scripts/pakem_core/__pycache__/intelligence.cpython-312.pyc +0 -0
  62. package/scripts/pakem_core/__pycache__/mcp_server.cpython-312.pyc +0 -0
  63. package/scripts/pakem_core/__pycache__/protocol.cpython-312.pyc +0 -0
  64. package/scripts/pakem_core/__pycache__/reconcile.cpython-312.pyc +0 -0
  65. package/scripts/pakem_core/__pycache__/runtime.cpython-312.pyc +0 -0
  66. package/scripts/pakem_core/coordination.py +977 -0
  67. package/scripts/pakem_core/git_worktree.py +265 -0
  68. package/scripts/pakem_core/identity.py +494 -0
  69. package/scripts/pakem_core/intelligence.py +684 -0
  70. package/scripts/pakem_core/mcp_server.py +308 -0
  71. package/scripts/pakem_core/protocol.py +61 -0
  72. package/scripts/pakem_core/reconcile.py +119 -0
  73. package/scripts/pakem_core/runtime.py +457 -0
  74. package/scripts/run_evals.py +289 -0
  75. package/storage/v1/README.md +14 -0
  76. package/storage/v1/team-storage.schema.json +27 -0
@@ -0,0 +1,14 @@
1
+ # Pakem Agent Identity v1
2
+
3
+ Pakem identity v1 uses Ed25519 public-key signatures for agent attestations and scoped delegation tokens.
4
+
5
+ - Public keys and revocation metadata live in `.pakem/identity/registry.json`.
6
+ - Private keys live outside the repository under the user's Pakem config directory and are written with owner-only permissions where supported.
7
+ - Signed envelopes cover canonical JSON, the agent ID, public-key fingerprint, and payload digest.
8
+ - Delegation tokens bind a subject to an audience, a finite action list, issue time, expiry, and unique token ID. Maximum lifetime is 24 hours.
9
+ - Revocation is checked against the project's public registry at verification time.
10
+ - `identity rotate` creates a new key ID and retains the retired public key/fingerprint metadata; old signatures no longer verify as active identity. The old private-key file remains in the local config directory for operator-controlled retirement.
11
+
12
+ The optional `cryptography` Python package is required for Ed25519 operations (`python -m pip install cryptography`). The rest of Pakem continues to work without it.
13
+
14
+ **Trust boundary:** signature verification proves possession of a registered private key at signing time. It does not authenticate a network connection, prove that an agent process is uncompromised, prevent replay by itself, or bind a claim to a real OS process. A trusted host must verify tokens, enforce audience/actions/expiry/revocation, bind the token to the caller, and apply its own replay policy.
@@ -0,0 +1,95 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:pakem:identity:v1:agent-identity",
4
+ "title": "Pakem Agent Public Identity v1",
5
+ "type": "object",
6
+ "required": [
7
+ "agentId",
8
+ "algorithm",
9
+ "publicKey",
10
+ "fingerprint",
11
+ "keyId",
12
+ "createdAt",
13
+ "revokedAt",
14
+ "previousKeys"
15
+ ],
16
+ "properties": {
17
+ "agentId": {
18
+ "type": "string",
19
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
20
+ },
21
+ "algorithm": {
22
+ "const": "Ed25519"
23
+ },
24
+ "publicKey": {
25
+ "type": "string",
26
+ "minLength": 40,
27
+ "maxLength": 64
28
+ },
29
+ "fingerprint": {
30
+ "type": "string",
31
+ "pattern": "^[a-f0-9]{64}$"
32
+ },
33
+ "keyId": {
34
+ "type": "string",
35
+ "pattern": "^[a-f0-9]{16}$"
36
+ },
37
+ "createdAt": {
38
+ "type": "string",
39
+ "format": "date-time"
40
+ },
41
+ "rotatedAt": {
42
+ "type": "string",
43
+ "format": "date-time"
44
+ },
45
+ "revokedAt": {
46
+ "type": [
47
+ "string",
48
+ "null"
49
+ ]
50
+ },
51
+ "revocationReason": {
52
+ "type": "string",
53
+ "maxLength": 300
54
+ },
55
+ "previousKeys": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "object",
59
+ "required": [
60
+ "fingerprint",
61
+ "publicKey",
62
+ "retiredAt",
63
+ "reason"
64
+ ],
65
+ "properties": {
66
+ "fingerprint": {
67
+ "type": "string",
68
+ "pattern": "^[a-f0-9]{64}$"
69
+ },
70
+ "publicKey": {
71
+ "type": "string",
72
+ "minLength": 40,
73
+ "maxLength": 64
74
+ },
75
+ "keyId": {
76
+ "type": [
77
+ "string",
78
+ "null"
79
+ ]
80
+ },
81
+ "retiredAt": {
82
+ "type": "string",
83
+ "format": "date-time"
84
+ },
85
+ "reason": {
86
+ "type": "string",
87
+ "maxLength": 300
88
+ }
89
+ },
90
+ "additionalProperties": false
91
+ }
92
+ }
93
+ },
94
+ "additionalProperties": false
95
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:pakem:identity:v1:identity-registry",
4
+ "title": "Pakem Agent Identity Registry v1",
5
+ "type": "object",
6
+ "required": [
7
+ "schemaVersion",
8
+ "agents"
9
+ ],
10
+ "properties": {
11
+ "schemaVersion": {
12
+ "const": 1
13
+ },
14
+ "updatedAt": {
15
+ "type": "string",
16
+ "format": "date-time"
17
+ },
18
+ "agents": {
19
+ "type": "object",
20
+ "propertyNames": {
21
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
22
+ },
23
+ "additionalProperties": {
24
+ "$ref": "urn:pakem:identity:v1:agent-identity"
25
+ }
26
+ }
27
+ },
28
+ "additionalProperties": false
29
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:pakem:identity:v1:signed-payload",
4
+ "title": "Pakem Ed25519 Signed Payload v1",
5
+ "type": "object",
6
+ "required": [
7
+ "format",
8
+ "algorithm",
9
+ "agentId",
10
+ "fingerprint",
11
+ "payload",
12
+ "payloadSha256",
13
+ "signature"
14
+ ],
15
+ "properties": {
16
+ "format": {
17
+ "const": "pakem.signed-payload.v1"
18
+ },
19
+ "algorithm": {
20
+ "const": "Ed25519"
21
+ },
22
+ "agentId": {
23
+ "type": "string",
24
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
25
+ },
26
+ "fingerprint": {
27
+ "type": "string",
28
+ "pattern": "^[a-f0-9]{64}$"
29
+ },
30
+ "payload": {},
31
+ "payloadSha256": {
32
+ "type": "string",
33
+ "pattern": "^[a-f0-9]{64}$"
34
+ },
35
+ "signature": {
36
+ "type": "string",
37
+ "minLength": 80,
38
+ "maxLength": 100
39
+ }
40
+ },
41
+ "additionalProperties": false
42
+ }
@@ -0,0 +1,19 @@
1
+ # Pakem Intelligence v1
2
+
3
+ The first language-independent output contracts for source dependency discovery and change-impact analysis.
4
+
5
+ ## Dependency graph
6
+
7
+ `pakem graph --json` emits `pakem.dependency-graph/v1`. Each edge points from the importer (`from`) to the imported local file (`to`). The scanner currently resolves common Python imports, relative JavaScript/TypeScript/Vue/Svelte imports, Go packages declared under the local `go.mod` module path, and Java/Kotlin package imports.
8
+
9
+ The graph is static and best-effort. Dynamic imports, reflection, dependency injection, generated sources, framework routing, path aliases, runtime configuration, and package-level semantics may not be fully represented. An absent edge is not proof that two files are unrelated.
10
+
11
+ ## Impact analysis
12
+
13
+ `pakem impact --files FILE... --json` emits `pakem.impact-analysis/v1`. `--base REF` selects `REF...HEAD`; `--staged` selects the Git index; with no selector Pakem inspects the working tree diff plus untracked files. The analysis reports direct and transitive reverse dependents, likely affected tests, risk signals, and suggested verification.
14
+
15
+ Risk is a heuristic prioritization signal, not a security rating. `--strict` returns exit code 1 for a HIGH signal; it does not change project policy or run tests. Use the result to decide what to inspect, then run the project's actual verification commands and review the changes.
16
+
17
+ ## Runtime and safety boundary
18
+
19
+ The scanner is read-only unless `graph --output PATH` is explicitly supplied. It does not execute source code, tests, package managers, build scripts, or network requests. Absolute paths outside the project root are rejected for impact input. The JSON contracts are independent of the CLI implementation and can be consumed by other runtimes.
@@ -0,0 +1,82 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:pakem:intelligence:v1:dependency-graph",
4
+ "title": "Pakem Dependency Graph v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "root", "node_count", "edge_count", "nodes", "edges", "unresolved_relative_imports", "limitations"],
7
+ "properties": {
8
+ "schema_version": {"const": "pakem.dependency-graph/v1"},
9
+ "root": {"type": "string"},
10
+ "node_count": {"type": "integer", "minimum": 0},
11
+ "edge_count": {"type": "integer", "minimum": 0},
12
+ "nodes": {
13
+ "type": "array",
14
+ "items": {
15
+ "type": "object",
16
+ "required": ["path", "language", "is_test", "size_bytes", "imports"],
17
+ "properties": {
18
+ "path": {"type": "string"},
19
+ "language": {"type": "string"},
20
+ "is_test": {"type": "boolean"},
21
+ "size_bytes": {"type": "integer", "minimum": 0},
22
+ "imports": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
23
+ },
24
+ "additionalProperties": false
25
+ }
26
+ },
27
+ "edges": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "object",
31
+ "required": ["from", "to"],
32
+ "properties": {"from": {"type": "string"}, "to": {"type": "string"}},
33
+ "additionalProperties": false
34
+ }
35
+ },
36
+ "unresolved_relative_imports": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "object",
40
+ "required": ["from", "specifier"],
41
+ "properties": {"from": {"type": "string"}, "specifier": {"type": "string"}},
42
+ "additionalProperties": false
43
+ }
44
+ },
45
+ "unresolved_imports": {
46
+ "description": "All local imports that failed to resolve, with the reason. `unresolved_relative_imports` remains as the legacy subset.",
47
+ "type": "array",
48
+ "items": {
49
+ "type": "object",
50
+ "required": ["from", "specifier", "reason"],
51
+ "properties": {
52
+ "from": {"type": "string"},
53
+ "specifier": {"type": "string"},
54
+ "reason": {"enum": ["relative", "alias", "baseUrl"]}
55
+ },
56
+ "additionalProperties": false
57
+ }
58
+ },
59
+ "aliases": {
60
+ "description": "Path alias rules read from tsconfig/jsconfig (following extends).",
61
+ "type": "array",
62
+ "items": {
63
+ "type": "object",
64
+ "required": ["prefix", "targets", "source"],
65
+ "properties": {
66
+ "prefix": {"type": "string"},
67
+ "targets": {"type": "array", "items": {"type": "string"}},
68
+ "source": {"type": "string"}
69
+ },
70
+ "additionalProperties": false
71
+ }
72
+ },
73
+ "circular_dependencies": {
74
+ "description": "Strongly connected components that contain a cycle; each component is a list of paths (at most 20 components).",
75
+ "type": "array",
76
+ "items": {"type": "array", "items": {"type": "string"}, "minItems": 1}
77
+ },
78
+ "circular_dependency_count": {"type": "integer", "minimum": 0},
79
+ "limitations": {"type": "array", "items": {"type": "string"}}
80
+ },
81
+ "additionalProperties": false
82
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:pakem:intelligence:v1:impact-analysis",
4
+ "title": "Pakem Impact Analysis v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "changed_files", "direct_dependents", "transitive_dependents", "affected_tests", "risk", "summary", "recommendations", "analysis_limits", "strict_blocked"],
7
+ "properties": {
8
+ "schema_version": {"const": "pakem.impact-analysis/v1"},
9
+ "changed_files": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
10
+ "direct_dependents": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
11
+ "transitive_dependents": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
12
+ "affected_tests": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
13
+ "risk": {
14
+ "type": "object",
15
+ "required": ["level", "score", "reasons"],
16
+ "properties": {
17
+ "level": {"enum": ["low", "medium", "high"]},
18
+ "score": {"type": "integer", "minimum": 0},
19
+ "reasons": {"type": "array", "items": {"type": "string"}}
20
+ },
21
+ "additionalProperties": false
22
+ },
23
+ "summary": {
24
+ "type": "object",
25
+ "required": ["changed_count", "direct_dependent_count", "transitive_dependent_count", "affected_test_count"],
26
+ "properties": {
27
+ "changed_count": {"type": "integer", "minimum": 0},
28
+ "direct_dependent_count": {"type": "integer", "minimum": 0},
29
+ "transitive_dependent_count": {"type": "integer", "minimum": 0},
30
+ "affected_test_count": {"type": "integer", "minimum": 0}
31
+ },
32
+ "additionalProperties": false
33
+ },
34
+ "graph_health": {
35
+ "description": "Quality of the graph used by this analysis. `complete: false` means some imports are unresolved, so dependents may go undetected.",
36
+ "type": "object",
37
+ "required": ["alias_rules", "unresolved_imports", "circular_dependencies", "complete"],
38
+ "properties": {
39
+ "alias_rules": {"type": "integer", "minimum": 0},
40
+ "unresolved_imports": {"type": "integer", "minimum": 0},
41
+ "circular_dependencies": {"type": "integer", "minimum": 0},
42
+ "complete": {"type": "boolean"}
43
+ },
44
+ "additionalProperties": false
45
+ },
46
+ "recommendations": {"type": "array", "items": {"type": "string"}},
47
+ "analysis_limits": {"type": "array", "items": {"type": "string"}},
48
+ "strict_blocked": {"type": "boolean"}
49
+ },
50
+ "additionalProperties": false
51
+ }
@@ -0,0 +1,156 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:pakem:intelligence:v1:reconciliation",
4
+ "title": "Pakem Artifact Reconciliation v1",
5
+ "description": "Output of `pakem reconcile --json`: comparison between the actual changes in the repo, the file scope declared by the plan, and the spec acceptance criteria. Advisory only; the gate still decides.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema_version",
9
+ "changed_files",
10
+ "declared_scope",
11
+ "in_scope",
12
+ "out_of_scope",
13
+ "code_out_of_scope",
14
+ "tasks",
15
+ "acceptance",
16
+ "summary",
17
+ "ok"
18
+ ],
19
+ "properties": {
20
+ "schema_version": {
21
+ "const": "pakem.reconciliation/v1"
22
+ },
23
+ "changed_files": {
24
+ "type": "array",
25
+ "items": {
26
+ "type": "string"
27
+ }
28
+ },
29
+ "declared_scope": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "string"
33
+ }
34
+ },
35
+ "in_scope": {
36
+ "type": "array",
37
+ "items": {
38
+ "type": "string"
39
+ }
40
+ },
41
+ "out_of_scope": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "string"
45
+ }
46
+ },
47
+ "code_out_of_scope": {
48
+ "type": "array",
49
+ "items": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "tasks": {
54
+ "type": "array",
55
+ "items": {
56
+ "type": "object",
57
+ "required": [
58
+ "taskId",
59
+ "done",
60
+ "declared",
61
+ "changed",
62
+ "untouched"
63
+ ],
64
+ "properties": {
65
+ "taskId": {
66
+ "type": "string"
67
+ },
68
+ "done": {
69
+ "type": "boolean"
70
+ },
71
+ "declared": {
72
+ "type": "array",
73
+ "items": {
74
+ "type": "string"
75
+ }
76
+ },
77
+ "changed": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string"
81
+ }
82
+ },
83
+ "untouched": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string"
87
+ }
88
+ }
89
+ },
90
+ "additionalProperties": false
91
+ }
92
+ },
93
+ "acceptance": {
94
+ "type": "object",
95
+ "required": [
96
+ "total",
97
+ "checked",
98
+ "unchecked"
99
+ ],
100
+ "properties": {
101
+ "total": {
102
+ "type": "integer",
103
+ "minimum": 0
104
+ },
105
+ "checked": {
106
+ "type": "integer",
107
+ "minimum": 0
108
+ },
109
+ "unchecked": {
110
+ "type": "array",
111
+ "items": {
112
+ "type": "string"
113
+ }
114
+ }
115
+ },
116
+ "additionalProperties": false
117
+ },
118
+ "summary": {
119
+ "type": "object",
120
+ "required": [
121
+ "changed",
122
+ "in_scope",
123
+ "out_of_scope",
124
+ "code_out_of_scope",
125
+ "acceptance_unchecked"
126
+ ],
127
+ "properties": {
128
+ "changed": {
129
+ "type": "integer",
130
+ "minimum": 0
131
+ },
132
+ "in_scope": {
133
+ "type": "integer",
134
+ "minimum": 0
135
+ },
136
+ "out_of_scope": {
137
+ "type": "integer",
138
+ "minimum": 0
139
+ },
140
+ "code_out_of_scope": {
141
+ "type": "integer",
142
+ "minimum": 0
143
+ },
144
+ "acceptance_unchecked": {
145
+ "type": "integer",
146
+ "minimum": 0
147
+ }
148
+ },
149
+ "additionalProperties": false
150
+ },
151
+ "ok": {
152
+ "type": "boolean"
153
+ }
154
+ },
155
+ "additionalProperties": false
156
+ }