@mytechtoday/url-reference-mapper 1.3.0 → 2.0.0-alpha.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.
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.truncateText = exports.getTextStats = exports.isPlainText = exports.extractUrls = exports.normalizeLineEndings = exports.parseText = void 0;
4
+ const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi;
5
+ function parseText(content) {
6
+ try {
7
+ const normalizedText = normalizeLineEndings(content);
8
+ const urls = extractUrls(normalizedText);
9
+ const lines = normalizedText.split('\n');
10
+ const lineCount = lines.length;
11
+ const charCount = normalizedText.length;
12
+ return {
13
+ text: normalizedText,
14
+ urls,
15
+ lineCount,
16
+ charCount,
17
+ };
18
+ }
19
+ catch (error) {
20
+ console.warn('Text parsing error:', error);
21
+ return {
22
+ text: content,
23
+ urls: [],
24
+ lineCount: 1,
25
+ charCount: content.length,
26
+ };
27
+ }
28
+ }
29
+ exports.parseText = parseText;
30
+ function normalizeLineEndings(text) {
31
+ return text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
32
+ }
33
+ exports.normalizeLineEndings = normalizeLineEndings;
34
+ function extractUrls(text) {
35
+ const urls = [];
36
+ const matches = text.matchAll(URL_REGEX);
37
+ for (const match of matches) {
38
+ urls.push(match[0]);
39
+ }
40
+ return [...new Set(urls)];
41
+ }
42
+ exports.extractUrls = extractUrls;
43
+ function isPlainText(content) {
44
+ if (content.includes('\0')) {
45
+ return false;
46
+ }
47
+ const printableChars = content.match(/[\x20-\x7E\n\r\t]/g)?.length || 0;
48
+ const totalChars = content.length;
49
+ if (totalChars === 0) {
50
+ return true;
51
+ }
52
+ const printableRatio = printableChars / totalChars;
53
+ return printableRatio > 0.8;
54
+ }
55
+ exports.isPlainText = isPlainText;
56
+ function getTextStats(text) {
57
+ const normalizedText = normalizeLineEndings(text);
58
+ const lines = normalizedText.split('\n');
59
+ const words = normalizedText.split(/\s+/).filter(w => w.length > 0);
60
+ const urls = extractUrls(normalizedText);
61
+ return {
62
+ lines: lines.length,
63
+ words: words.length,
64
+ chars: normalizedText.length,
65
+ urls: urls.length,
66
+ };
67
+ }
68
+ exports.getTextStats = getTextStats;
69
+ function truncateText(text, maxLength, suffix = '...') {
70
+ if (text.length <= maxLength) {
71
+ return text;
72
+ }
73
+ return text.substring(0, maxLength - suffix.length) + suffix;
74
+ }
75
+ exports.truncateText = truncateText;
76
+ //# sourceMappingURL=text-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-parser.js","sourceRoot":"","sources":["../../src/parsers/text-parser.ts"],"names":[],"mappings":";;;AA0BA,MAAM,SAAS,GAAG,uGAAuG,CAAC;AAQ1H,SAAgB,SAAS,CAAC,OAAe;IACvC,IAAI,CAAC;QAEH,MAAM,cAAc,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAGrD,MAAM,IAAI,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;QAGzC,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;QAG/B,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC;QAExC,OAAO;YACL,IAAI,EAAE,cAAc;YACpB,IAAI;YACJ,SAAS;YACT,SAAS;SACV,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAG3C,OAAO;YACL,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,EAAE;YACR,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,OAAO,CAAC,MAAM;SAC1B,CAAC;IACJ,CAAC;AACH,CAAC;A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C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;IAEzC,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,KAAK,EAAE,cAAc,CAAC,MAAM;QAC5B,IAAI,EAAE,IAAI,CAAC,MAAM;KAClB,CAAC;AACJ,CAAC;AAjBD,oCAiBC;AAUD,SAAgB,YAAY,CAAC,IAAY,EAAE,SAAiB,EAAE,SAAiB,KAAK;IAClF,IAAI,IAAI,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAC/D,CAAC;AAND,oCAMC"}
package/dist/types.d.ts CHANGED
@@ -4,6 +4,20 @@ export interface UrlMapping {
4
4
  localPath: string;
5
5
  lastUpdated?: string;
6
6
  metadata?: Record<string, any>;
7
+ wordCount?: number;
8
+ readingTime?: number;
9
+ tags?: string;
10
+ summary?: string;
11
+ tldr?: string;
12
+ categories?: string;
13
+ author?: string;
14
+ featuredImages?: string[];
15
+ authorImage?: string;
16
+ authorUrl?: string;
17
+ quotes?: string[];
18
+ internalLinks?: string[];
19
+ externalLinks?: string[];
20
+ relatedPosts?: string[];
7
21
  }
8
22
  export interface UrlReferenceMapperConfig {
9
23
  configPath?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IAEzB,KAAK,EAAE,MAAM,CAAC;IAEd,GAAG,EAAE,MAAM,CAAC;IAEZ,SAAS,EAAE,MAAM,CAAC;IAElB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC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AqB,CAAC;IAE5B,OAAO,EAAE,MAAM,CAAC;IAEhB,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAKD,MAAM,WAAW,gBAAgB;IAE/B,KAAK,EAAE,OAAO,CAAC;IAEf,MAAM,EAAE,eAAe,EAAE,CAAC;IAE1B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAKD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,75 +1,74 @@
1
- {
2
- "name": "@mytechtoday/url-reference-mapper",
3
- "version": "1.3.0",
4
- "description": "Bidirectional mapping between local filesystem paths and published internet URLs for Augment AI workflows",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "bin": {
8
- "url-ref-mapper": "dist/cli.js"
9
- },
10
- "files": [
11
- "dist/",
12
- "schema.json",
13
- "README.md",
14
- "LICENSE",
15
- "CHANGELOG.md"
16
- ],
17
- "scripts": {
18
- "build": "tsc",
19
- "dev": "tsc --watch",
20
- "test": "jest",
21
- "test:watch": "jest --watch",
22
- "test:coverage": "jest --coverage",
23
- "lint": "eslint src/**/*.ts",
24
- "lint:fix": "eslint src/**/*.ts --fix",
25
- "format": "prettier --write \"src/**/*.ts\"",
26
- "prepare": "npm run build",
27
- "prepublishOnly": "npm run lint && npm run test && npm run build",
28
- "validate": "node dist/cli.js validate"
29
- },
30
- "keywords": [
31
- "url-mapping",
32
- "path-mapping",
33
- "augment-ai",
34
- "openspec",
35
- "beads",
36
- "url-reference",
37
- "filesystem",
38
- "wordpress",
39
- "static-site",
40
- "developer-tools"
41
- ],
42
- "author": "MyTech.Today",
43
- "license": "MIT",
44
- "repository": {
45
- "type": "git",
46
- "url": "https://github.com/mytech-today-now/url-reference.git"
47
- },
48
- "bugs": {
49
- "url": "https://github.com/mytech-today-now/url-reference/issues"
50
- },
51
- "homepage": "https://github.com/mytech-today-now/url-reference#readme",
52
- "engines": {
53
- "node": ">=16.0.0"
54
- },
55
- "publishConfig": {
56
- "access": "public"
57
- },
58
- "dependencies": {
59
- "commander": "^11.0.0",
60
- "js-yaml": "^4.1.1"
61
- },
62
- "devDependencies": {
63
- "@types/jest": "^29.5.0",
64
- "@types/js-yaml": "^4.0.9",
65
- "@types/node": "^20.0.0",
66
- "@typescript-eslint/eslint-plugin": "^6.0.0",
67
- "@typescript-eslint/parser": "^6.0.0",
68
- "eslint": "^8.50.0",
69
- "jest": "^29.7.0",
70
- "prettier": "^3.0.0",
71
- "ts-jest": "^29.1.0",
72
- "typescript": "^5.3.3"
73
- }
74
- }
75
-
1
+ {
2
+ "name": "@mytechtoday/url-reference-mapper",
3
+ "version": "2.0.0-alpha.1",
4
+ "description": "Bidirectional mapping between local filesystem paths and published internet URLs for Augment AI workflows. v2.0.0 planning: Enhanced CLI with comprehensive help system, advanced features, and utility commands (in development).",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "url-ref-mapper": "dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist/",
12
+ "schema.json",
13
+ "README.md",
14
+ "LICENSE",
15
+ "CHANGELOG.md"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "dev": "tsc --watch",
20
+ "test": "jest",
21
+ "test:watch": "jest --watch",
22
+ "test:coverage": "jest --coverage",
23
+ "lint": "eslint src/**/*.ts",
24
+ "lint:fix": "eslint src/**/*.ts --fix",
25
+ "format": "prettier --write \"src/**/*.ts\"",
26
+ "prepare": "npm run build",
27
+ "prepublishOnly": "npm run lint && npm run test && npm run build",
28
+ "validate": "node dist/cli.js validate"
29
+ },
30
+ "keywords": [
31
+ "url-mapping",
32
+ "path-mapping",
33
+ "augment-ai",
34
+ "openspec",
35
+ "beads",
36
+ "url-reference",
37
+ "filesystem",
38
+ "wordpress",
39
+ "static-site",
40
+ "developer-tools"
41
+ ],
42
+ "author": "MyTech.Today",
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "https://github.com/mytech-today-now/url-reference.git"
47
+ },
48
+ "bugs": {
49
+ "url": "https://github.com/mytech-today-now/url-reference/issues"
50
+ },
51
+ "homepage": "https://github.com/mytech-today-now/url-reference#readme",
52
+ "engines": {
53
+ "node": ">=16.0.0"
54
+ },
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "dependencies": {
59
+ "commander": "^11.0.0",
60
+ "js-yaml": "^4.1.1"
61
+ },
62
+ "devDependencies": {
63
+ "@types/jest": "^29.5.0",
64
+ "@types/js-yaml": "^4.0.9",
65
+ "@types/node": "^20.0.0",
66
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
67
+ "@typescript-eslint/parser": "^6.0.0",
68
+ "eslint": "^8.50.0",
69
+ "jest": "^29.7.0",
70
+ "prettier": "^3.0.0",
71
+ "ts-jest": "^29.1.0",
72
+ "typescript": "^5.3.3"
73
+ }
74
+ }
package/schema.json CHANGED
@@ -1,172 +1,172 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://github.com/mytech-today-now/url-reference/schema.json",
4
- "title": "URL Reference Mapper Schema",
5
- "description": "JSON Schema for @mytechtoday/url-reference-mapper package types",
6
- "definitions": {
7
- "UrlMapping": {
8
- "type": "object",
9
- "description": "Represents a bidirectional mapping between a local filesystem path and a published internet URL",
10
- "required": ["title", "url", "localPath"],
11
- "properties": {
12
- "title": {
13
- "type": "string",
14
- "description": "Human-readable title for the mapping",
15
- "minLength": 1,
16
- "examples": [
17
- "Copper ETFs and Investment Vehicles: 2026",
18
- "Mid-Tier & Junior Copper Miners: 2026 Analysis"
19
- ]
20
- },
21
- "url": {
22
- "type": "string",
23
- "format": "uri",
24
- "description": "Published internet URL (must be a valid HTTP/HTTPS URL)",
25
- "pattern": "^https?://",
26
- "examples": [
27
- "https://mytech.today/copper-etfs-and-investment-vehicles-2026/",
28
- "https://example.com/blog/post-title/"
29
- ]
30
- },
31
- "localPath": {
32
- "type": "string",
33
- "description": "Local filesystem path (absolute or relative). Absolute paths are recommended.",
34
- "minLength": 1,
35
- "examples": [
36
- "G:\\blogs\\copper-mining-part-4-etf-investment-vehicles.html",
37
- "/home/user/projects/blogs/post.html",
38
- "C:\\projects\\blogs\\post.html"
39
- ]
40
- },
41
- "lastUpdated": {
42
- "type": "string",
43
- "format": "date-time",
44
- "description": "ISO 8601 timestamp of when the mapping was last updated",
45
- "examples": [
46
- "2026-01-27T17:04:00-06:00",
47
- "2026-01-30T12:00:00Z"
48
- ]
49
- },
50
- "metadata": {
51
- "type": "object",
52
- "description": "Optional additional metadata for the mapping",
53
- "additionalProperties": true,
54
- "examples": [
55
- {
56
- "category": "technology",
57
- "tags": ["copper", "mining", "investment"],
58
- "author": "John Doe"
59
- }
60
- ]
61
- }
62
- },
63
- "additionalProperties": false
64
- },
65
- "ValidationErrorType": {
66
- "type": "string",
67
- "enum": [
68
- "duplicate_url",
69
- "duplicate_path",
70
- "invalid_url",
71
- "missing_file",
72
- "invalid_format"
73
- ],
74
- "description": "Types of validation errors that can occur"
75
- },
76
- "ValidationWarningType": {
77
- "type": "string",
78
- "enum": [
79
- "outdated_timestamp",
80
- "relative_path",
81
- "missing_metadata"
82
- ],
83
- "description": "Types of validation warnings that can occur"
84
- },
85
- "ValidationError": {
86
- "type": "object",
87
- "required": ["type", "message"],
88
- "properties": {
89
- "type": {
90
- "$ref": "#/definitions/ValidationErrorType"
91
- },
92
- "message": {
93
- "type": "string",
94
- "description": "Human-readable error message"
95
- },
96
- "mapping": {
97
- "$ref": "#/definitions/UrlMapping",
98
- "description": "The mapping that caused the error"
99
- }
100
- }
101
- },
102
- "ValidationWarning": {
103
- "type": "object",
104
- "required": ["type", "message"],
105
- "properties": {
106
- "type": {
107
- "$ref": "#/definitions/ValidationWarningType"
108
- },
109
- "message": {
110
- "type": "string",
111
- "description": "Human-readable warning message"
112
- },
113
- "mapping": {
114
- "$ref": "#/definitions/UrlMapping",
115
- "description": "The mapping that caused the warning"
116
- }
117
- }
118
- },
119
- "ValidationResult": {
120
- "type": "object",
121
- "required": ["valid", "errors", "warnings"],
122
- "properties": {
123
- "valid": {
124
- "type": "boolean",
125
- "description": "Whether all mappings are valid"
126
- },
127
- "errors": {
128
- "type": "array",
129
- "items": {
130
- "$ref": "#/definitions/ValidationError"
131
- },
132
- "description": "Array of validation errors"
133
- },
134
- "warnings": {
135
- "type": "array",
136
- "items": {
137
- "$ref": "#/definitions/ValidationWarning"
138
- },
139
- "description": "Array of validation warnings"
140
- }
141
- }
142
- },
143
- "MapperConfig": {
144
- "type": "object",
145
- "description": "Configuration options for UrlReferenceMapper",
146
- "properties": {
147
- "configPath": {
148
- "type": "string",
149
- "description": "Path to configuration file (JSON or YAML)"
150
- },
151
- "mappings": {
152
- "type": "array",
153
- "items": {
154
- "$ref": "#/definitions/UrlMapping"
155
- },
156
- "description": "Inline mappings (alternative to configPath)"
157
- },
158
- "autoSave": {
159
- "type": "boolean",
160
- "default": false,
161
- "description": "Automatically save changes to file"
162
- },
163
- "validateOnLoad": {
164
- "type": "boolean",
165
- "default": true,
166
- "description": "Validate mappings when loading"
167
- }
168
- }
169
- }
170
- }
171
- }
172
-
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://github.com/mytech-today-now/url-reference/schema.json",
4
+ "title": "URL Reference Mapper Schema",
5
+ "description": "JSON Schema for @mytechtoday/url-reference-mapper package types",
6
+ "definitions": {
7
+ "UrlMapping": {
8
+ "type": "object",
9
+ "description": "Represents a bidirectional mapping between a local filesystem path and a published internet URL",
10
+ "required": ["title", "url", "localPath"],
11
+ "properties": {
12
+ "title": {
13
+ "type": "string",
14
+ "description": "Human-readable title for the mapping",
15
+ "minLength": 1,
16
+ "examples": [
17
+ "Copper ETFs and Investment Vehicles: 2026",
18
+ "Mid-Tier & Junior Copper Miners: 2026 Analysis"
19
+ ]
20
+ },
21
+ "url": {
22
+ "type": "string",
23
+ "format": "uri",
24
+ "description": "Published internet URL (must be a valid HTTP/HTTPS URL)",
25
+ "pattern": "^https?://",
26
+ "examples": [
27
+ "https://mytech.today/copper-etfs-and-investment-vehicles-2026/",
28
+ "https://example.com/blog/post-title/"
29
+ ]
30
+ },
31
+ "localPath": {
32
+ "type": "string",
33
+ "description": "Local filesystem path (absolute or relative). Absolute paths are recommended.",
34
+ "minLength": 1,
35
+ "examples": [
36
+ "G:\\blogs\\copper-mining-part-4-etf-investment-vehicles.html",
37
+ "/home/user/projects/blogs/post.html",
38
+ "C:\\projects\\blogs\\post.html"
39
+ ]
40
+ },
41
+ "lastUpdated": {
42
+ "type": "string",
43
+ "format": "date-time",
44
+ "description": "ISO 8601 timestamp of when the mapping was last updated",
45
+ "examples": [
46
+ "2026-01-27T17:04:00-06:00",
47
+ "2026-01-30T12:00:00Z"
48
+ ]
49
+ },
50
+ "metadata": {
51
+ "type": "object",
52
+ "description": "Optional additional metadata for the mapping",
53
+ "additionalProperties": true,
54
+ "examples": [
55
+ {
56
+ "category": "technology",
57
+ "tags": ["copper", "mining", "investment"],
58
+ "author": "John Doe"
59
+ }
60
+ ]
61
+ }
62
+ },
63
+ "additionalProperties": false
64
+ },
65
+ "ValidationErrorType": {
66
+ "type": "string",
67
+ "enum": [
68
+ "duplicate_url",
69
+ "duplicate_path",
70
+ "invalid_url",
71
+ "missing_file",
72
+ "invalid_format"
73
+ ],
74
+ "description": "Types of validation errors that can occur"
75
+ },
76
+ "ValidationWarningType": {
77
+ "type": "string",
78
+ "enum": [
79
+ "outdated_timestamp",
80
+ "relative_path",
81
+ "missing_metadata"
82
+ ],
83
+ "description": "Types of validation warnings that can occur"
84
+ },
85
+ "ValidationError": {
86
+ "type": "object",
87
+ "required": ["type", "message"],
88
+ "properties": {
89
+ "type": {
90
+ "$ref": "#/definitions/ValidationErrorType"
91
+ },
92
+ "message": {
93
+ "type": "string",
94
+ "description": "Human-readable error message"
95
+ },
96
+ "mapping": {
97
+ "$ref": "#/definitions/UrlMapping",
98
+ "description": "The mapping that caused the error"
99
+ }
100
+ }
101
+ },
102
+ "ValidationWarning": {
103
+ "type": "object",
104
+ "required": ["type", "message"],
105
+ "properties": {
106
+ "type": {
107
+ "$ref": "#/definitions/ValidationWarningType"
108
+ },
109
+ "message": {
110
+ "type": "string",
111
+ "description": "Human-readable warning message"
112
+ },
113
+ "mapping": {
114
+ "$ref": "#/definitions/UrlMapping",
115
+ "description": "The mapping that caused the warning"
116
+ }
117
+ }
118
+ },
119
+ "ValidationResult": {
120
+ "type": "object",
121
+ "required": ["valid", "errors", "warnings"],
122
+ "properties": {
123
+ "valid": {
124
+ "type": "boolean",
125
+ "description": "Whether all mappings are valid"
126
+ },
127
+ "errors": {
128
+ "type": "array",
129
+ "items": {
130
+ "$ref": "#/definitions/ValidationError"
131
+ },
132
+ "description": "Array of validation errors"
133
+ },
134
+ "warnings": {
135
+ "type": "array",
136
+ "items": {
137
+ "$ref": "#/definitions/ValidationWarning"
138
+ },
139
+ "description": "Array of validation warnings"
140
+ }
141
+ }
142
+ },
143
+ "MapperConfig": {
144
+ "type": "object",
145
+ "description": "Configuration options for UrlReferenceMapper",
146
+ "properties": {
147
+ "configPath": {
148
+ "type": "string",
149
+ "description": "Path to configuration file (JSON or YAML)"
150
+ },
151
+ "mappings": {
152
+ "type": "array",
153
+ "items": {
154
+ "$ref": "#/definitions/UrlMapping"
155
+ },
156
+ "description": "Inline mappings (alternative to configPath)"
157
+ },
158
+ "autoSave": {
159
+ "type": "boolean",
160
+ "default": false,
161
+ "description": "Automatically save changes to file"
162
+ },
163
+ "validateOnLoad": {
164
+ "type": "boolean",
165
+ "default": true,
166
+ "description": "Validate mappings when loading"
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+