import assert from 'node:assert/strict'
import {pathToFileURL} from 'node:url'
import path from 'node:path'
const args=process.argv.slice(2);const i=args.indexOf('--native')
if(i<0||!args[i+1])throw new Error('Pass --native <fixed genuine include-filename.ts>')
const native=path.resolve(args[i+1])
const {includeFilename}=await import(pathToFileURL(native).href)
const rows=[]
function check(name,input,expected) {
let actual
try {actual={value:includeFilename(input.path,input.base,input.platform)}}
catch(error){actual={errorCode:error.code ?? error.name}}
assert.deepEqual(actual,expected,name)
rows.push({name,input,operation:'actual unmodified DSH includeFilename via Node native TypeScript stripping',expected,actual})
}
const base='file:///C:/owned/root/config.yml'
for(const [name,p,expected] of [
['relative_child','child/cordis.yml','C:\\owned\\root\\child\\cordis.yml'],
['relative_parent','../shared.yml','C:\\owned\\shared.yml'],
['drive_backslashes','D:\\owned\\patch.yml','D:\\owned\\patch.yml'],
['drive_slashes','D:/owned/patch.yml','D:\\owned\\patch.yml'],
['drive_space','D:\\owned\\a b.yml','D:\\owned\\a b.yml'],
['relative_encoded_space','config%20one.yml','C:\\owned\\root\\config one.yml'],
['file_url_hash_encoded','file:///C:/owned/a%23b.yml','C:\\owned\\a#b.yml'],
['relative_fragment_is_not_filename','patch.yml#section','C:\\owned\\root\\patch.yml'],
['drive_hash_is_filename','D:\\owned\\a#b.yml','D:\\owned\\a#b.yml'],
['file_url_unc','file://owned-server/share/patch.yml','\\\\owned-server\\share\\patch.yml']
])check(name,{path:p,base,platform:'win32'},{value:expected})
check('HTTP_target_rejected',{path:'https://owned.invalid/patch.yml',base,platform:'win32'},{errorCode:'ERR_INVALID_URL_SCHEME'})
check('HTTP_base_rejected',{path:'child.yml',base:'https://owned.invalid/base/',platform:'win32'},{errorCode:'ERR_INVALID_URL_SCHEME'})
check('encoded_separator_rejected',{path:'child%2Fpatch.yml',base,platform:'win32'},{errorCode:'ERR_INVALID_FILE_URL_PATH'})
check('POSIX_relative',{path:'../patch.yml',base:'file:///srv/main/config.yml',platform:'linux'},{value:'/srv/patch.yml'})
check('POSIX_absolute',{path:'/tmp/owned.yml',base:'file:///srv/main/config.yml',platform:'linux'},{value:'/tmp/owned.yml'})
check('POSIX_file_url',{path:'file:///srv/owned%20path/a.yml',base:'file:///srv/main/config.yml',platform:'linux'},{value:'/srv/owned path/a.yml'})
console.log(JSON.stringify({node:process.versions.node,cases:rows,scope:'16 real fixed-source includeFilename helper observations with inert path strings. No Include plugin loading, filesystem read/write of candidate paths, patch merging, DSH launcher/profile/application, model, network or repository script executed. POSIX cases use explicit platform argument on Windows, not a POSIX-host runtime.'}))
本例需在 Windows、Node24.22.3;直接运行固定MIT软件单模块,未启动DSH应用。 中运行,请复制源码、保存文件或下载工程包后在本地执行验证。
运行说明与环境独立工程
运行环境:Windows、Node24.22.3;直接运行固定MIT软件单模块,未启动DSH应用。
入口文件:projects/deepseek-harness-concepts/include_probe.mjs
本地运行步骤快速上手
- 点击上方“保存源码”保存为
include_probe.mjs,或下载右侧课程工程包。 - 确认本地已准备 Windows、Node24.22.3;直接运行固定MIT软件单模块,未启动DSH应用。。
- 按对应章节命令执行,结合正文核对实际输出。
附件与关联工程包下载
课程关联工程包(登记关联1章) · 含当前章节或实例 · mbskycom202612a138.zip
课程关联工程包(登记关联33章) · 含当前章节或实例 · mbskycom202612a128.zip