@agpm/core 0.1.0 → 0.1.1
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/config.d.ts.map +1 -1
- package/dist/config.js +24 -20
- package/dist/config.js.map +1 -1
- package/dist/validate.js +2 -2
- package/dist/validate.js.map +1 -1
- package/package.json +3 -2
- package/schemas/agpm-lock.json +66 -0
- package/schemas/agpm.json +99 -0
- package/LICENSE +0 -21
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;CAE5B;AAED,2CAA2C;AAC3C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,oBAAoB,GAAG,eAAe,GAAG,QAAQ,CAAC;AAEtF,wCAAwC;AACxC,MAAM,WAAW,MAAM;IACrB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,wEAAwE;IACxE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,qCAAqC;IACrC,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM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eAAO,MAAM,YAAY,EAAE,QAI1B,CAAC;AASF,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA4BjE;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/E;AAED,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAwB7D;AAED,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzE"}
|
package/dist/config.js
CHANGED
|
@@ -59,19 +59,10 @@ const CONFIG_FILE = "agpm.json";
|
|
|
59
59
|
const LOCK_FILE = "agpm-lock.json";
|
|
60
60
|
export async function loadConfig(dir) {
|
|
61
61
|
const path = join(dir, CONFIG_FILE);
|
|
62
|
+
// Read the config file
|
|
63
|
+
let content;
|
|
62
64
|
try {
|
|
63
|
-
|
|
64
|
-
const config = JSON.parse(content);
|
|
65
|
-
// Validate against schema
|
|
66
|
-
const result = await validateConfig(config);
|
|
67
|
-
if (!result.valid) {
|
|
68
|
-
throw new Error(`Invalid ${CONFIG_FILE}:\n${formatValidationErrors(result.errors)}`);
|
|
69
|
-
}
|
|
70
|
-
// Provide defaults for optional fields
|
|
71
|
-
return {
|
|
72
|
-
...config,
|
|
73
|
-
collections: config.collections ?? [],
|
|
74
|
-
};
|
|
65
|
+
content = await readFile(path, "utf-8");
|
|
75
66
|
}
|
|
76
67
|
catch (error) {
|
|
77
68
|
if (error.code === "ENOENT") {
|
|
@@ -79,6 +70,17 @@ export async function loadConfig(dir) {
|
|
|
79
70
|
}
|
|
80
71
|
throw error;
|
|
81
72
|
}
|
|
73
|
+
// Parse and validate (errors here should propagate, not return defaults)
|
|
74
|
+
const config = JSON.parse(content);
|
|
75
|
+
const result = await validateConfig(config);
|
|
76
|
+
if (!result.valid) {
|
|
77
|
+
throw new Error(`Invalid ${CONFIG_FILE}:\n${formatValidationErrors(result.errors)}`);
|
|
78
|
+
}
|
|
79
|
+
// Provide defaults for optional fields
|
|
80
|
+
return {
|
|
81
|
+
...config,
|
|
82
|
+
collections: config.collections ?? [],
|
|
83
|
+
};
|
|
82
84
|
}
|
|
83
85
|
export async function saveConfig(dir, config) {
|
|
84
86
|
const path = join(dir, CONFIG_FILE);
|
|
@@ -89,15 +91,10 @@ export async function saveConfig(dir, config) {
|
|
|
89
91
|
}
|
|
90
92
|
export async function loadLock(dir) {
|
|
91
93
|
const path = join(dir, LOCK_FILE);
|
|
94
|
+
// Read the lock file
|
|
95
|
+
let content;
|
|
92
96
|
try {
|
|
93
|
-
|
|
94
|
-
const lock = JSON.parse(content);
|
|
95
|
-
// Validate against schema
|
|
96
|
-
const result = await validateLock(lock);
|
|
97
|
-
if (!result.valid) {
|
|
98
|
-
throw new Error(`Invalid ${LOCK_FILE}:\n${formatValidationErrors(result.errors)}`);
|
|
99
|
-
}
|
|
100
|
-
return lock;
|
|
97
|
+
content = await readFile(path, "utf-8");
|
|
101
98
|
}
|
|
102
99
|
catch (error) {
|
|
103
100
|
if (error.code === "ENOENT") {
|
|
@@ -105,6 +102,13 @@ export async function loadLock(dir) {
|
|
|
105
102
|
}
|
|
106
103
|
throw error;
|
|
107
104
|
}
|
|
105
|
+
// Parse and validate (errors here should propagate, not return defaults)
|
|
106
|
+
const lock = JSON.parse(content);
|
|
107
|
+
const result = await validateLock(lock);
|
|
108
|
+
if (!result.valid) {
|
|
109
|
+
throw new Error(`Invalid ${LOCK_FILE}:\n${formatValidationErrors(result.errors)}`);
|
|
110
|
+
}
|
|
111
|
+
return lock;
|
|
108
112
|
}
|
|
109
113
|
export async function saveLock(dir, lock) {
|
|
110
114
|
const path = join(dir, LOCK_FILE);
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/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CAAC,CAAC;IAElC,qBAAqB;IACrB,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;QAC7B,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;IAED,yEAAyE;IACzE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAa,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,WAAW,SAAS,MAAM,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAClE,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAW,EAAE,IAAc;IACxD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAClC,oCAAoC;IACpC,MAAM,cAAc,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,CAAC;IAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IAC/D,MAAM,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/validate.js
CHANGED
|
@@ -2,9 +2,9 @@ import Ajv from "ajv";
|
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { join, dirname } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
// Get the schemas directory path
|
|
5
|
+
// Get the schemas directory path (schemas are bundled with the package)
|
|
6
6
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
-
const SCHEMAS_DIR = join(__dirname, "
|
|
7
|
+
const SCHEMAS_DIR = join(__dirname, "../schemas");
|
|
8
8
|
// Create Ajv instance
|
|
9
9
|
const ajv = new Ajv.default({
|
|
10
10
|
allErrors: true,
|
package/dist/validate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,GAAyB,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,GAAyB,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,wEAAwE;AACxE,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAElD,sBAAsB;AACtB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC;IAC1B,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAEH,eAAe;AACf,IAAI,YAAgC,CAAC;AACrC,IAAI,UAA8B,CAAC;AAEnC;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AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAa;IAC9C,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,MAAM,GAAsB,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAgB,EAAE,EAAE,CAAC,CAAC;QACnF,IAAI,EAAE,GAAG,CAAC,YAAY,IAAI,GAAG;QAC7B,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,0BAA0B;KACnD,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAyB;IAC9D,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agpm/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Core library for AGPM - config, git, discovery, caching, validation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"dist"
|
|
22
|
+
"dist",
|
|
23
|
+
"schemas"
|
|
23
24
|
],
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"ajv": "^8.17.1",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://agpm.dev/schemas/agpm-lock.json",
|
|
4
|
+
"title": "AGPM Lock File",
|
|
5
|
+
"description": "Lock file for reproducible artifact installations",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "JSON Schema reference"
|
|
11
|
+
},
|
|
12
|
+
"version": {
|
|
13
|
+
"type": "integer",
|
|
14
|
+
"description": "Lock file format version",
|
|
15
|
+
"const": 1
|
|
16
|
+
},
|
|
17
|
+
"artifacts": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"description": "Locked artifact resolutions",
|
|
20
|
+
"additionalProperties": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"description": "Resolved artifact details",
|
|
23
|
+
"properties": {
|
|
24
|
+
"sha": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Git commit SHA (40 characters)",
|
|
27
|
+
"pattern": "^[a-f0-9]{40}$"
|
|
28
|
+
},
|
|
29
|
+
"integrity": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Content integrity hash (sha256-...)",
|
|
32
|
+
"pattern": "^sha256-[A-Za-z0-9+/=]+$"
|
|
33
|
+
},
|
|
34
|
+
"path": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "Relative path within the repository"
|
|
37
|
+
},
|
|
38
|
+
"ref": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "Original version ref (tag, branch, or SHA) if specified"
|
|
41
|
+
},
|
|
42
|
+
"metadata": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"description": "Discovered artifact metadata",
|
|
45
|
+
"properties": {
|
|
46
|
+
"name": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Artifact name"
|
|
49
|
+
},
|
|
50
|
+
"description": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Artifact description"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"required": ["name"],
|
|
56
|
+
"additionalProperties": true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"required": ["sha", "integrity", "path", "metadata"],
|
|
60
|
+
"additionalProperties": false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"required": ["version", "artifacts"],
|
|
65
|
+
"additionalProperties": false
|
|
66
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://agpm.dev/schemas/agpm.json",
|
|
4
|
+
"title": "AGPM Configuration",
|
|
5
|
+
"description": "Configuration file for the Agent Package Manager",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "JSON Schema reference"
|
|
11
|
+
},
|
|
12
|
+
"targets": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"description": "AI tools to install artifacts to. Only install to targets that are listed.",
|
|
15
|
+
"propertyNames": {
|
|
16
|
+
"enum": ["claude-code", "opencode", "codex"]
|
|
17
|
+
},
|
|
18
|
+
"additionalProperties": {
|
|
19
|
+
"oneOf": [
|
|
20
|
+
{
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"description": "Enable (true) or disable (false) this target"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "object",
|
|
26
|
+
"description": "Target-specific configuration options (currently empty)",
|
|
27
|
+
"additionalProperties": false
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"examples": [
|
|
32
|
+
{
|
|
33
|
+
"claude-code": true,
|
|
34
|
+
"opencode": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"claude-code": {},
|
|
38
|
+
"opencode": {}
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"sources": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"description": "Git repositories or local paths containing artifacts",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"description": "Source configuration",
|
|
48
|
+
"properties": {
|
|
49
|
+
"name": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "Display name for the source (e.g., 'anthropics/skills')"
|
|
52
|
+
},
|
|
53
|
+
"url": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "Full git URL for cloning"
|
|
56
|
+
},
|
|
57
|
+
"format": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"enum": ["auto", "claude-marketplace", "claude-plugin", "simple"],
|
|
60
|
+
"description": "Format for artifact discovery. Defaults to 'auto' if omitted."
|
|
61
|
+
},
|
|
62
|
+
"subdir": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Subdirectory within the repo to use as root"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": ["name", "url"],
|
|
68
|
+
"additionalProperties": false
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"collections": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"description": "Collection references (expand to their artifacts at install time)",
|
|
74
|
+
"items": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "Collection reference in format: source/collection-name",
|
|
77
|
+
"examples": [
|
|
78
|
+
"anthropics/skills/office-suite",
|
|
79
|
+
"my-org/plugins/productivity"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"artifacts": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"description": "Individual artifact references to install",
|
|
86
|
+
"items": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": "Artifact reference in format: source/name[@version]",
|
|
89
|
+
"examples": [
|
|
90
|
+
"anthropics/skills/pdf",
|
|
91
|
+
"anthropics/skills/pdf@1.0.0",
|
|
92
|
+
"anthropics/skills#experimental/new-skill@latest"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"required": ["targets", "sources", "artifacts"],
|
|
98
|
+
"additionalProperties": false
|
|
99
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Kepler16
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|