Skip to content

Commit d41e592

Browse files
committed
0.7.4 - Fix error message
`Reference tags must have a prompt attribute`. Should be `Reference tags must have a `path` attribute`
1 parent 5906160 commit d41e592

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ TODO.md
5858
bin
5959

6060
AGENTS.md
61+
62+
# Vim crap
63+
*-E

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "promptl-ai",
3-
"version": "0.7.3",
3+
"version": "0.7.4",
44
"author": "Latitude Data",
55
"license": "MIT",
66
"description": "Compiler for PromptL, the prompt language",

src/compiler/base/nodes/tags/ref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function compile(
3232
}
3333

3434
const { path, ...refParameters } = attributes
35-
if (!path) baseNodeError(errors.referenceTagWithoutPrompt, node)
35+
if (!path) baseNodeError(errors.referenceTagWithoutPath, node)
3636
if (typeof path !== 'string') baseNodeError(errors.invalidReferencePath, node)
3737

3838
if (!nodeWithStatus.status.refAst || !nodeWithStatus.status.refFullPath) {

src/compiler/scan.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import sha256 from 'fast-sha256'
33
import {
44
CUSTOM_MESSAGE_ROLE_ATTR,
55
REFERENCE_DEPTH_LIMIT,
6-
REFERENCE_PROMPT_ATTR,
6+
REFERENCE_PATH_ATTR,
77
TAG_NAMES,
88
} from '$promptl/constants'
99
import CompileError, { error } from '$promptl/error/error'
@@ -543,11 +543,11 @@ export class Scan {
543543
const attributes = await this.listTagAttributes({
544544
tagNode: node,
545545
scopeContext,
546-
literalAttributes: [REFERENCE_PROMPT_ATTR],
546+
literalAttributes: [REFERENCE_PATH_ATTR],
547547
})
548548

549-
if (!attributes.has(REFERENCE_PROMPT_ATTR)) {
550-
this.baseNodeError(errors.referenceTagWithoutPrompt, node)
549+
if (!attributes.has(REFERENCE_PATH_ATTR)) {
550+
this.baseNodeError(errors.referenceTagWithoutPath, node)
551551
return
552552
}
553553

@@ -562,14 +562,14 @@ export class Scan {
562562
}
563563

564564
const refPromptAttribute = node.attributes.find(
565-
(attribute: Attribute) => attribute.name === REFERENCE_PROMPT_ATTR,
565+
(attribute: Attribute) => attribute.name === REFERENCE_PATH_ATTR,
566566
) as Attribute
567567

568568
const refPromptPath = (refPromptAttribute.value as TemplateNode[])
569569
.map((node) => node.data)
570570
.join('')
571571

572-
attributes.delete(REFERENCE_PROMPT_ATTR) // The rest of the attributes are used as parameters
572+
attributes.delete(REFERENCE_PATH_ATTR) // The rest of the attributes are used as parameters
573573

574574
const currentReferences = this.references[this.fullPath] ?? []
575575

@@ -653,7 +653,7 @@ export class Scan {
653653
const posttext = this.resolvedPrompt.slice(end)
654654

655655
const attributeTags = node.attributes
656-
.filter((a) => a.name !== REFERENCE_PROMPT_ATTR)
656+
.filter((a) => a.name !== REFERENCE_PATH_ATTR)
657657
.map((attr) => {
658658
const attrStart = attr.start! + this.resolvedPromptOffset
659659
const attrEnd = attr.end! + this.resolvedPromptOffset

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export enum TAG_NAMES {
2121

2222
export const CUSTOM_MESSAGE_ROLE_ATTR = 'role' as const
2323
export const CUSTOM_CONTENT_TYPE_ATTR = 'type' as const
24-
export const REFERENCE_PROMPT_ATTR = 'path' as const
24+
export const REFERENCE_PATH_ATTR = 'path' as const
2525
export const REFERENCE_DEPTH_LIMIT = 50
2626
export const CHAIN_STEP_ISOLATED_ATTR = 'isolated' as const
2727

src/error/errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ export default {
186186
code: 'message-tag-without-role',
187187
message: 'Message tags must have a role attribute',
188188
},
189-
referenceTagWithoutPrompt: {
189+
referenceTagWithoutPath: {
190190
code: 'reference-tag-without-prompt',
191-
message: 'Reference tags must have a prompt attribute',
191+
message: 'Reference tags must have a `path` attribute',
192192
},
193193
missingReferenceFunction: {
194194
code: 'missing-reference-function',

0 commit comments

Comments
 (0)