@diagrammo/dgmo 0.8.6 → 0.8.7
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/.claude/commands/dgmo.md +1 -27
- package/.cursorrules +2 -2
- package/.github/copilot-instructions.md +2 -2
- package/.windsurfrules +2 -2
- package/AGENTS.md +2 -2
- package/README.md +0 -1
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/docs/ai-integration.md +1 -1
- package/docs/language-reference.md +81 -162
- package/package.json +1 -1
- package/src/boxes-and-lines/parser.ts +4 -1
- package/src/gantt/parser.ts +4 -1
- package/src/infra/parser.ts +4 -1
- package/src/kanban/parser.ts +4 -1
- package/src/utils/tag-groups.ts +38 -14
package/src/utils/tag-groups.ts
CHANGED
|
@@ -109,10 +109,15 @@ export function parseTagDeclaration(line: string): TagBlockMatch | null {
|
|
|
109
109
|
// BEFORE any value tokens (values have `(color)` suffixes or appear after we see a comma).
|
|
110
110
|
|
|
111
111
|
// First check for explicit `alias` keyword: `tag Name alias X`
|
|
112
|
-
const aliasKeywordIdx = tokens.findIndex(
|
|
112
|
+
const aliasKeywordIdx = tokens.findIndex(
|
|
113
|
+
(t, i) => i > 0 && t.toLowerCase() === 'alias'
|
|
114
|
+
);
|
|
113
115
|
if (aliasKeywordIdx > 0 && aliasKeywordIdx + 1 < tokens.length) {
|
|
114
116
|
// Everything before `alias` is the name, the token after `alias` is the alias
|
|
115
|
-
name = tokens
|
|
117
|
+
name = tokens
|
|
118
|
+
.slice(0, aliasKeywordIdx)
|
|
119
|
+
.map((t) => stripQuotes(t))
|
|
120
|
+
.join(' ');
|
|
116
121
|
alias = tokens[aliasKeywordIdx + 1];
|
|
117
122
|
restStartIdx = aliasKeywordIdx + 2;
|
|
118
123
|
} else {
|
|
@@ -123,7 +128,11 @@ export function parseTagDeclaration(line: string): TagBlockMatch | null {
|
|
|
123
128
|
|
|
124
129
|
if (tokens.length === 1) {
|
|
125
130
|
// Just `tag Name` — no alias, no values
|
|
126
|
-
} else if (
|
|
131
|
+
} else if (
|
|
132
|
+
tokens.length === 2 &&
|
|
133
|
+
isAliasToken(tokens[1]) &&
|
|
134
|
+
!commaInRemaining
|
|
135
|
+
) {
|
|
127
136
|
// `tag Priority p` — alias only, no values
|
|
128
137
|
alias = tokens[1];
|
|
129
138
|
restStartIdx = 2;
|
|
@@ -150,11 +159,17 @@ export function parseTagDeclaration(line: string): TagBlockMatch | null {
|
|
|
150
159
|
if (valueStart > 1 && isAliasToken(tokens[valueStart - 1])) {
|
|
151
160
|
alias = tokens[valueStart - 1];
|
|
152
161
|
// Name is everything from token[0] to token[valueStart-2]
|
|
153
|
-
name = tokens
|
|
162
|
+
name = tokens
|
|
163
|
+
.slice(0, valueStart - 1)
|
|
164
|
+
.map((t) => stripQuotes(t))
|
|
165
|
+
.join(' ');
|
|
154
166
|
restStartIdx = valueStart;
|
|
155
167
|
} else {
|
|
156
168
|
// No alias — name is everything before values
|
|
157
|
-
name = tokens
|
|
169
|
+
name = tokens
|
|
170
|
+
.slice(0, valueStart)
|
|
171
|
+
.map((t) => stripQuotes(t))
|
|
172
|
+
.join(' ');
|
|
158
173
|
restStartIdx = valueStart;
|
|
159
174
|
}
|
|
160
175
|
}
|
|
@@ -166,7 +181,10 @@ export function parseTagDeclaration(line: string): TagBlockMatch | null {
|
|
|
166
181
|
if (restStartIdx < tokens.length) {
|
|
167
182
|
// Rejoin and split by comma for inline values
|
|
168
183
|
const valueStr = tokens.slice(restStartIdx).join(' ');
|
|
169
|
-
inlineValues = valueStr
|
|
184
|
+
inlineValues = valueStr
|
|
185
|
+
.split(',')
|
|
186
|
+
.map((v) => v.trim())
|
|
187
|
+
.filter(Boolean);
|
|
170
188
|
}
|
|
171
189
|
|
|
172
190
|
// Check for trailing color hint on name (without inline values)
|
|
@@ -183,7 +201,8 @@ export function parseTagDeclaration(line: string): TagBlockMatch | null {
|
|
|
183
201
|
name,
|
|
184
202
|
alias,
|
|
185
203
|
colorHint,
|
|
186
|
-
inlineValues:
|
|
204
|
+
inlineValues:
|
|
205
|
+
inlineValues && inlineValues.length > 0 ? inlineValues : undefined,
|
|
187
206
|
};
|
|
188
207
|
}
|
|
189
208
|
|
|
@@ -224,9 +243,8 @@ export function resolveTagColor(
|
|
|
224
243
|
if (!metaValue) return '#999999';
|
|
225
244
|
|
|
226
245
|
return (
|
|
227
|
-
group.entries.find(
|
|
228
|
-
|
|
229
|
-
)?.color ?? '#999999'
|
|
246
|
+
group.entries.find((e) => e.value.toLowerCase() === metaValue.toLowerCase())
|
|
247
|
+
?.color ?? '#999999'
|
|
230
248
|
);
|
|
231
249
|
}
|
|
232
250
|
|
|
@@ -243,7 +261,10 @@ export function resolveTagColor(
|
|
|
243
261
|
* @param suggestFn Optional did-you-mean suggestion function
|
|
244
262
|
*/
|
|
245
263
|
export function validateTagValues(
|
|
246
|
-
entities: ReadonlyArray<{
|
|
264
|
+
entities: ReadonlyArray<{
|
|
265
|
+
metadata: Record<string, string>;
|
|
266
|
+
lineNumber: number;
|
|
267
|
+
}>,
|
|
247
268
|
tagGroups: ReadonlyArray<TagGroup>,
|
|
248
269
|
pushWarning: (lineNumber: number, message: string) => void,
|
|
249
270
|
suggestFn?: (input: string, candidates: readonly string[]) => string | null
|
|
@@ -264,8 +285,8 @@ export function validateTagValues(
|
|
|
264
285
|
// Suppress warning if the value is a prefix of any valid entry —
|
|
265
286
|
// the user is likely still typing (live parse during editing).
|
|
266
287
|
const valueLower = value.toLowerCase();
|
|
267
|
-
const isPrefix = group.entries.some(
|
|
268
|
-
|
|
288
|
+
const isPrefix = group.entries.some((e) =>
|
|
289
|
+
e.value.toLowerCase().startsWith(valueLower)
|
|
269
290
|
);
|
|
270
291
|
if (!isPrefix) {
|
|
271
292
|
const defined = group.entries.map((e) => e.value);
|
|
@@ -301,7 +322,10 @@ export function injectDefaultTagMetadata(
|
|
|
301
322
|
const defaults: { key: string; value: string }[] = [];
|
|
302
323
|
for (const group of tagGroups) {
|
|
303
324
|
if (group.defaultValue) {
|
|
304
|
-
defaults.push({
|
|
325
|
+
defaults.push({
|
|
326
|
+
key: group.name.toLowerCase(),
|
|
327
|
+
value: group.defaultValue,
|
|
328
|
+
});
|
|
305
329
|
}
|
|
306
330
|
}
|
|
307
331
|
if (defaults.length === 0) return;
|