Skip to content

fix(skills): aiscript-author の組込み関数の記載を実処理系に合わせる - #35

Merged
hitalin merged 1 commit into
mainfrom
fix/aiscript-author-builtins
Aug 8, 2026
Merged

fix(skills): aiscript-author の組込み関数の記載を実処理系に合わせる#35
hitalin merged 1 commit into
mainfrom
fix/aiscript-author-builtins

Conversation

@hitalin

@hitalin hitalin commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

なぜ

aiscript-author skill が、AiScript に存在しない組込み関数を代表例として載せていた。
記載どおりに書くと実行時に No such variable で落ちる。

厄介なのは構文エラーにならないこと。パースは通るので aiscript.validate
通しても検出されず、実際に動かして初めて失敗する。実際に、この記載を信じて書いた
ウィジェットが Str:to_arr で落ちた。

何を直したか

AiScript 1.2.1 の実インタプリタで 1 件ずつ存在確認した結果:

記載されていた 実際
Str:len Str:to_arr Str:upper Str:lower どれも無いStr:Str:lf Str:gt Str:lt Str:from_* だけ
Arr:len Arr:push Arr:map Arr:filter Arr:reduce どれも無いArr:Arr:create のみ
Math:pi Math:PI
Math:random() Math:rnd()

あわせて:

  • 文字列・配列はメソッド形式(s.trim().lower() / a.push(x))で操作する節を追加
  • 実在するのに未記載だった Obj:pick Json:parsable Date:to_iso_str
    Uri:encode_component Num:from_hex などを補足
  • Date:month() が 0 埋めされない点を明記
  • トラブルシュート表に No such variable・予約語 out・数値と文字列の連結エラーを追加

検証

追加・修正した例はすべて実際にインタプリタで実行して出力を確認した。
既存のレジストリアイテムに同じ誤用が無いことも確認済み(影響はドキュメントのみ)。

version: 1.2.0 → 1.2.1

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Updated the AiScript authoring reference to version 1.2.1.
    • Expanded guidance for Math, object, JSON, date, URI, utility, error, and numeric APIs.
    • Added examples and clarified method syntax for string and array operations.
    • Documented date formatting, mathematical constants, reserved words, and number/string concatenation pitfalls.
    • Updated troubleshooting guidance for common runtime errors and incorrect syntax.
  • Chores

    • Refreshed the skill registry metadata and integrity information.

存在しない API が代表例として載っており、そのとおり書くと実行時に
`No such variable` で落ちる状態だった。AiScript 1.2.1 の実インタプリタで
1 件ずつ確認し、実在するものだけに置き換えた。

- `Str:len` / `Str:to_arr` / `Str:upper` / `Str:lower` は存在しない。
  `Str:` にあるのは `Str:lf` / `Str:gt` / `Str:lt` と `Str:from_*` だけ
- `Arr:len` / `Arr:push` / `Arr:map` / `Arr:filter` / `Arr:reduce` も存在しない。
  `Arr:` にあるのは `Arr:create` のみ
- `Math:pi` は `Math:PI`、`Math:random()` は `Math:rnd()` が正しい

文字列・配列はメソッド形式 (`s.trim().lower()` / `a.push(x)`) で操作する旨を
節として追加し、記載した例はすべて実際に実行して出力を確認した。
あわせて Obj: / Date: / Uri: / Num: の実在関数を補い、トラブルシュート表に
`No such variable`・予約語 `out`・数値と文字列の連結エラーの行を足した。

これらは構文エラーにならず parse は通ってしまうため、パースだけでは
気付けない。その注意書きも本文に入れた。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
misstore 73ac6b9 Aug 08 2026, 10:59 PM

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The AiScript author skill was updated from version 1.2.0 to 1.2.1. The API reference and troubleshooting guidance were revised, and the registry timestamp, version, and checksum were updated.

Changes

AiScript author skill update

Layer / File(s) Summary
Update AiScript reference content
public/registry/skills/aiscript-author/api.json, public/registry/skills/aiscript-author/skill.md
The reference now documents expanded APIs, method-based string and array operations, date formatting guidance, updated examples, and additional troubleshooting cases.
Publish registry metadata
public/registry/skills.json
The registry timestamp, aiscript-author version, and SHA-512 checksum were updated.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは、aiscript-authorの組込み関数の記載を実処理系に合わせて修正するという変更の主目的を明確に示しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/aiscript-author-builtins

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hitalin hitalin self-assigned this Aug 8, 2026
@hitalin
hitalin merged commit 5c953b0 into main Aug 8, 2026
4 of 5 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@public/registry/skills/aiscript-author/skill.md`:
- Line 180: Update the code fence in the aiscript-author skill documentation to
specify the aiscript language tag, changing the untagged fence to ```aiscript
and resolving the MD040 warning.
- Around line 282-284: 表の見出しを、`aiscript.validate`
が扱う構文エラーだけに限定しない一般的な「よくある落とし穴」へ変更するか、`No such variable 'Str:lower'` と `Expect
number, but got str.` を実行時エラーとして別見出し・別区分に分けてください。`Reserved word "out"`
を含む既存の説明内容は維持してください。
- Line 167: Update the Date function signature list to document
Date:to_iso_str(t?, time_offset?) instead of only its first argument, matching
the standard reference’s optional time_offset parameter.
- Around line 185-191: In the AiScript examples block, split every chained
expression currently sharing a line into separate lines, keeping one expression
per line so aiscript.validate parses each statement correctly.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d4a0a8a-1fde-4bfb-a69b-b8fb8228535d

📥 Commits

Reviewing files that changed from the base of the PR and between 059112a and 73ac6b9.

📒 Files selected for processing (3)
  • public/registry/skills.json
  • public/registry/skills/aiscript-author/api.json
  • public/registry/skills/aiscript-author/skill.md

`Obj:copy(o)`, `Obj:merge(a, b)`, `Obj:pick(o, keys)`
- `Json:stringify(x)`, `Json:parse(s)`, `Json:parsable(s)`
- `Date:now()`, `Date:year(t?)`, `Date:month(t?)`, `Date:day(t?)`, `Date:hour(t?)`,
`Date:minute(t?)`, `Date:second(t?)`, `Date:parse(s)`, `Date:to_iso_str(t?)`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat >/tmp/aiscript-date-1.2.1.ai <<'AISCRIPT'
/// @ 1.2.1
Date:to_iso_str(Date:now(), 0)
AISCRIPT

: "${AISCRIPT_RUNNER:?Set AISCRIPT_RUNNER to the AiScript 1.2.1 runner}"
"$AISCRIPT_RUNNER" /tmp/aiscript-date-1.2.1.ai

Repository: notedeck-dev/misstore

Length of output: 239


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== target line =="
sed -n '155,175p' public/registry/skills/aiscript-author/skill.md || true

echo
echo "== package/version references =="
rg -n '"aiscript"|aiscript|`@1`\.2\.1|aiscript-dev\.github\.io/end|Date:to_iso_str' . --glob '!node_modules' --glob '!dist' --glob '!build' | head -200

echo
echo "== nearby public refs to aiscript version =="
rg -n 'aiscript|AiScript|AISCRIPT|npmjs\.com/package/aiscript|github\.com/kawaitekkou' . --glob '!node_modules' --glob '!dist' --glob '!build' | head -200

Repository: notedeck-dev/misstore

Length of output: 50382


🌐 Web query:

AiScript standard library Date:to_iso_str time_offset parameter

💡 Result:

In the AiScript standard library, the Date:to_iso_str function is defined as @Date:to_iso_str(date?: num, time_offset?: num): str [1][2]. The time_offset parameter represents the time difference from UTC in minutes [1][2]. It dictates the offset applied to the date string's time component [3]. Key details regarding this parameter: - Optional: If the time_offset parameter is not provided, the function defaults to using the host environment's local time offset [1][2]. - Functionality: The value passed (in minutes) is used to calculate and format the ISO 8601 string offset (e.g., +HH:MM or -HH:MM) [3][4]. If the offset is 0, it appends 'Z' (UTC) to the resulting string [3][5]. - Implementation: The underlying implementation uses Math.sign(offset) to determine the sign and calculates the corresponding hours and minutes for the ISO string representation [3][5].

Citations:


🌐 Web query:

aiScript 1.2.1 Date:to_iso_str arguments

💡 Result:

In AiScript, the Date:to_iso_str function is defined with the following signature: @Date:to_iso_str(date?: num, time_offset?: num): str [1] The arguments function as follows: date (optional, type: num): The date to convert, represented as a timestamp (number). If this argument is not provided, the current system time is used [1][2]. time_offset (optional, type: num): The time difference from UTC, expressed in minutes [1]. If this argument is not provided, the local time offset is used [1][2]. The function returns a string representing the date in extended ISO 8601 format [1].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== installed `@syuilo/aiscript` versions in lockfile =="
rg -n '^/@syuilo/aiscript@|`@syuilo/aiscript`@|name: "`@syuilo/aiscript`"|syuilo/aiscript' pnpm-lock.yaml package.json pnpm-workspace.yaml --max-count=80 || true

echo
echo "== static parse of Date:to_iso_str signatures from aiscript-dev references =="
python3 - <<'PY'
import urllib.request
urls = [
    "https://aiscript-dev.github.io/ja/references/std.html",
    "https://aiscript-dev.github.io/en/references/std.html",
]
for url in urls:
    text = urllib.request.urlopen(url, timeout=15).read().decode("utf-8", "replace")
    for needle in ["Date:to_iso_str", "Date:from_iso_str"]:
        idx = text.find(needle)
        print(f"\n--- {url} {needle} ---")
        print(text[max(0, idx-1200):idx+1600] if idx != -1 else "NOT_FOUND")
PY

Repository: notedeck-dev/misstore

Length of output: 2578


Date:to_iso_str の第二引数を併記してください。

標準リファレンスの Date:to_iso_str(date?: num, time_offset?: num): str に合わせるため、Date:to_iso_str(t?, time_offset?) としてください。

🧰 Tools
🪛 LanguageTool

[typographical] ~167-~167: 2つの連続するコンマ
Context: ... Date:minute(t?), Date:second(t?), Date:parse(s), Date:to_iso_str(t?) - ...

(DOUBLE_PUNCTUATION)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@public/registry/skills/aiscript-author/skill.md` at line 167, Update the Date
function signature list to document Date:to_iso_str(t?, time_offset?) instead of
only its first argument, matching the standard reference’s optional time_offset
parameter.

書くと `No such variable 'Str:len'` で実行時に落ちる (構文エラーにはならないので
パースだけでは気付けない)。値のメソッドとして呼ぶこと:

```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

コードフェンスに aiscript の言語タグを付けてください。

このフェンスは言語タグがなく、markdownlint の MD040 警告が発生しています。 ```aiscript に変更してください。

修正例
-```
+```aiscript
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 180-180: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@public/registry/skills/aiscript-author/skill.md` at line 180, Update the code
fence in the aiscript-author skill documentation to specify the aiscript
language tag, changing the untagged fence to ```aiscript and resolving the MD040
warning.

Source: Linters/SAST tools

Comment on lines +185 to +191
s.replace("a", "b") s.incl("mi") s.index_of("k") s.slice(0, 4)
s.starts_with("m") s.pad_start(4, "0")

var a = [3, 1, 2]
a.len // 長さ (Arr:len は無い)
a.push(4) a.incl(3) a.map(@(x) { x * 2 }) a.filter(@(x) { x > 1 })
a.sort(@(x, y) { x - y }) a.reduce(@(acc, x) { acc + x }, 0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## locate file"
if [ -f "public/registry/skills/aiscript-author/skill.md" ]; then
  wc -l public/registry/skills/aiscript-author/skill.md
  sed -n '160,210p' public/registry/skills/aiscript-author/skill.md | nl -ba -v160
else
  fd -i 'skill\.md$' .
fi

echo
echo "## nearby fences and markers"
rg -n '(^```aiscript|^```|Lines:|a\.sort|start_with|index_of|pad_start|incl)' public/registry/skills/aiscript-author/skill.md || true

echo
echo "## parse-ish check for consecutive AiScript expressions on same line"
python3 - <<'PY'
from pathlib import Path
p = Path("public/registry/skills/aiscript-author/skill.md")
text = p.read_text()
lines = text.splitlines()
target = "public/registry/skills/aiscript-author/skill.md"
print(f"file:{target} lines:{len(lines)}")
for i, line in enumerate(lines, 1):
    if "var a = [3, 1, 2]" in line or "s.replace" in line or "a.sort" in line:
        print(f"\nline {i}: {line!r}")
        print("count expr-ish by token separators around known expressions:", len(line.split("   ")))
PY

Repository: notedeck-dev/misstore

Length of output: 266


🌐 Web query:

AiScript syntax multiple statements one line semicolon separator

💡 Result:

AiScript does not support the use of semicolons as a separator for multiple statements on a single line. In fact, the language has explicitly obsoleted the use of semicolons as delimiters in various contexts, such as within object literals, where using them will result in a syntax error [1]. While some documentation may refer to AiScript as a semicolon-terminated language where semicolons are used at the end of statements [2], others emphasize that it is designed to be easy to write without the need for semicolons or commas [3]. To group multiple statements, AiScript uses curly braces {} to create a block [4]. You cannot simply chain statements on one line using semicolons. For example, the following is invalid: {a: 12; b: 'hoge'} // Syntax Error [1] If you need to execute multiple statements, they should typically be organized into blocks or written on separate lines [4][1].

Citations:


🌐 Web query:

site:aiscript-dev.github.io/en Aoi script reference syntax line breaks separate statements

💡 Result:

In AiScript, statements do not require explicit delimiters like semicolons; instead, line breaks are used to separate statements [1]. Statements must start at the beginning of a line or within specific syntax elements that accept expressions [1]. Key points regarding AiScript syntax: - Statement Separation: Line breaks serve as the primary delimiter for statements [1]. Semicolon delimiters have been explicitly obsoleted and will result in syntax errors [2]. - Structure: Statements are distinct from expressions [1]. While statements are generally expected to be at the start of a line, expressions can be used within various syntax elements [1]. - Block Delimiters: Object literals and array definitions also allow line breaks to separate elements [2]. Blank space delimiters between elements (e.g., inside object literals) have been obsoleted in favor of line breaks or commas [2].

Citations:


🌐 Web query:

"Multiple lines are separated by line breaks" "AiScript" syntax

💡 Result:

In AiScript, line breaks are treated as valid separators in many contexts, allowing for multi-line code structures. Key rules regarding line breaks include: Arrays and Objects Elements within arrays ([ ]) and properties within objects ({ }) can be separated by line breaks instead of commas. For example: [ 'hoge' 'huga' 'piyo' ] { a: 12 b: 'hoge' } Function Arguments and Blocks Line breaks are permitted in function definitions and calls, as well as within control flow blocks like if statements [1][2]. For instance, arguments in a function definition can span multiple lines [1][2]: @( x, y) { x + y } String Literals Within backtick-enclosed strings ( ), line breaks are allowed as part of the string content. To represent a line feed explicitly within a string, you can use the constant { Str:lf } [2][3]. General Syntax - Semicolons and blank delimiters are generally obsolete in AiScript [2]. - Line breaks are prohibited before or after an expression when used inside certain templates (e.g., inside backtick strings where an expression is interpolated) [2]. - Comments can also span multiple lines when enclosed in /* */ [1][4].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## file line count"
wc -l public/registry/skills/aiscript-author/skill.md

echo
echo "## lines 180-196"
awk 'NR>=180 && NR<=196 { printf "%4d  %s\n", NR, $0 }' public/registry/skills/aiscript-author/skill.md

echo
echo "## nearby code fences"
rg -n '(^```|code example|AiScript|aiscript|var a = \[3|a\.sort|s\.replace|start_with|index_of|pad_start|incl)' public/registry/skills/aiscript-author/skill.md || true

echo
echo "## deterministic separation analysis for cited region"
python3 - <<'PY'
from pathlib import Path
p = Path("public/registry/skills/aiscript-author/skill.md")
lines = p.read_text().splitlines()
for i in range(184, 191):
    line = lines[i-1]
    print(f"line {i}: ({len(line.split())}) {line!r}")
PY

Repository: notedeck-dev/misstore

Length of output: 2703


各 AiScript 式を改行で分けてください。

このブロックは aiscript.validate で検証対象です。AiScript では空白ではなく改行で文を分けるため、Lines 185-186, 190-191 の複数式を同じ行に書かずに、1 行 1 式にしてください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@public/registry/skills/aiscript-author/skill.md` around lines 185 - 191, In
the AiScript examples block, split every chained expression currently sharing a
line into separate lines, keeping one expression per line so aiscript.validate
parses each statement correctly.

Comment on lines +282 to +284
| `No such variable 'Str:lower'` | 文字列/配列を名前空間関数で操作した | メソッド形式 `s.lower()` / `a.push(x)` に直す |
| `Reserved word "out"` | `out` を変数名にした | 別名にする (`Log` 出力用に予約されている) |
| `Expect number, but got str.` | `Date:year(t) + ""` のような数値と文字列の連結 | テンプレート文字列 `` `{Date:year(t)}` `` を使う |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="public/registry/skills/aiscript-author/skill.md"
if [ -f "$file" ]; then
  echo "== file exists =="
  wc -l "$file"
  echo "== target lines 240-300 =="
  sed -n '240,300p' "$file" | cat -n
  echo "== nearby headings/tables =="
  rg -n "##|validate|よくある|落とし穴|No such variable|Reserved word|Expect number|aiscript\.validate" "$file"
else
  echo "missing $file"
fi

echo "== repository files =="
git ls-files | rg 'public/registry/skills/aiscript-author|aiscript|validator|validate' | head -100

Repository: notedeck-dev/misstore

Length of output: 3610


🌐 Web query:

AiScript Str:lower Date:year No such variable Expect number but got str aiscript validate

💡 Result:

In AiScript, functions like Date:year expect a number if an argument is provided, as they perform internal type validation [1][2]. The error "Expect number but got str" occurs when a string value is passed to a function or operation that strictly requires a numeric input [2]. Regarding your query: 1. Date:year expects an optional number argument (a timestamp). If you pass a string to it, the interpreter's internal validation will fail, resulting in a type error [1][2]. 2. Str:lower is a method applied to string objects (e.g., "TEXT".lower) [3]. It is not a standalone function that takes a date or other types as an argument. 3. The "No such variable" error usually indicates that an identifier used in your script (e.g., inside an interpolated string like {variable_name}) has not been defined in the current scope [4]. To resolve these issues: - Ensure that any argument passed to Date:year is a number (timestamp). If you do not need to specify a date, call it without arguments: Date:year [1][5]. - Ensure you are calling.lower on a string object, for example: "ABC".lower [3]. - Verify that all variables referenced in your script or interpolated strings exist and are defined before use [4].

Citations:


見出しの検証範囲を修正してください。

aiscript.validate は構文レベルで弾かれる問題を表しています。この表の No such variable 'Str:lower' / Expect number, but got str. は実行時エラーなので、見出しを一般的な「よくある落とし穴」に広げるか、構文エラーと実行時エラーを分けてください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@public/registry/skills/aiscript-author/skill.md` around lines 282 - 284,
表の見出しを、`aiscript.validate` が扱う構文エラーだけに限定しない一般的な「よくある落とし穴」へ変更するか、`No such
variable 'Str:lower'` と `Expect number, but got str.`
を実行時エラーとして別見出し・別区分に分けてください。`Reserved word "out"` を含む既存の説明内容は維持してください。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant