@lesliechan721/aw 0.1.0-beta.58 → 0.1.0-beta.60

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.
Files changed (79) hide show
  1. package/dist/authoring/scripts/lib/plugin-version-check.mjs +1 -1
  2. package/dist/authoring/scripts/validate-plugin.mjs +22 -4
  3. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  4. package/dist/native-runtime/reader-runtime.mjs +34 -0
  5. package/dist/native-runtime/reader.d.mts +6 -0
  6. package/dist/native-runtime/reader.mjs +11 -0
  7. package/dist/scripts/bundle-plugins.js +4 -13
  8. package/dist/scripts/bundle-plugins.js.map +1 -1
  9. package/dist/scripts/test-plugin-scripts.d.ts +3 -0
  10. package/dist/scripts/test-plugin-scripts.js +89 -10
  11. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  12. package/dist/src/authoring/workspace-commands.d.ts +2 -0
  13. package/dist/src/authoring/workspace-commands.js +3 -1
  14. package/dist/src/authoring/workspace-commands.js.map +1 -1
  15. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  16. package/dist/src/commands/aw-capabilities.js +1 -0
  17. package/dist/src/commands/aw-capabilities.js.map +1 -1
  18. package/dist/src/commands/managed-commands.d.ts +2 -0
  19. package/dist/src/commands/managed-commands.js +41 -3
  20. package/dist/src/commands/managed-commands.js.map +1 -1
  21. package/dist/src/commands/operation-plan.d.ts +8 -1
  22. package/dist/src/commands/operation-plan.js.map +1 -1
  23. package/dist/src/commands/plugin-capabilities.js +13 -0
  24. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  25. package/dist/src/commands/rebuild-command.js +67 -21
  26. package/dist/src/commands/rebuild-command.js.map +1 -1
  27. package/dist/src/commands/rebuild-integration.js +33 -6
  28. package/dist/src/commands/rebuild-integration.js.map +1 -1
  29. package/dist/src/commands/runtime.js +3 -3
  30. package/dist/src/commands/runtime.js.map +1 -1
  31. package/dist/src/commands/sync-command.js +4 -0
  32. package/dist/src/commands/sync-command.js.map +1 -1
  33. package/dist/src/commands/write-commands.js +17 -8
  34. package/dist/src/commands/write-commands.js.map +1 -1
  35. package/dist/src/generators/local-plugin.js +10 -1
  36. package/dist/src/generators/local-plugin.js.map +1 -1
  37. package/dist/src/index.js +14 -4
  38. package/dist/src/index.js.map +1 -1
  39. package/dist/src/output/command-receipt.d.ts +2 -0
  40. package/dist/src/output/command-receipt.js +5 -0
  41. package/dist/src/output/command-receipt.js.map +1 -1
  42. package/dist/src/portable/materializer.js +4 -0
  43. package/dist/src/portable/materializer.js.map +1 -1
  44. package/dist/src/review/skill-materialization.js +4 -0
  45. package/dist/src/review/skill-materialization.js.map +1 -1
  46. package/dist/src/tui/controller-runtime.js +7 -0
  47. package/dist/src/tui/controller-runtime.js.map +1 -1
  48. package/dist/src/tui/operation-review-planner.js +12 -1
  49. package/dist/src/tui/operation-review-planner.js.map +1 -1
  50. package/dist/src/utils/managed-command-materialization.d.ts +10 -1
  51. package/dist/src/utils/managed-command-materialization.js +56 -4
  52. package/dist/src/utils/managed-command-materialization.js.map +1 -1
  53. package/dist/src/utils/managed-command-runtime.d.ts +10 -9
  54. package/dist/src/utils/managed-command-runtime.js +19 -8
  55. package/dist/src/utils/managed-command-runtime.js.map +1 -1
  56. package/dist/src/utils/managed-command-store.d.ts +6 -2
  57. package/dist/src/utils/managed-command-store.js +20 -7
  58. package/dist/src/utils/managed-command-store.js.map +1 -1
  59. package/dist/src/utils/native-cli.d.ts +6 -0
  60. package/dist/src/utils/native-cli.js +32 -6
  61. package/dist/src/utils/native-cli.js.map +1 -1
  62. package/dist/src/utils/native-tool-context.d.ts +14 -0
  63. package/dist/src/utils/native-tool-context.js +38 -0
  64. package/dist/src/utils/native-tool-context.js.map +1 -0
  65. package/dist/src/utils/native-tool-review.d.ts +21 -0
  66. package/dist/src/utils/native-tool-review.js +102 -0
  67. package/dist/src/utils/native-tool-review.js.map +1 -0
  68. package/dist/src/utils/plugin-config-write.js +30 -2
  69. package/dist/src/utils/plugin-config-write.js.map +1 -1
  70. package/dist/src/utils/plugin-scripts.js +14 -7
  71. package/dist/src/utils/plugin-scripts.js.map +1 -1
  72. package/dist/src/utils/process-lock.js +3 -1
  73. package/dist/src/utils/process-lock.js.map +1 -1
  74. package/dist/src/utils/process-tree.d.ts +2 -2
  75. package/dist/src/utils/process-tree.js +1 -1
  76. package/dist/src/utils/process-tree.js.map +1 -1
  77. package/dist/vitest.config.js +10 -1
  78. package/dist/vitest.config.js.map +1 -1
  79. package/package.json +8 -7
@@ -10,7 +10,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
10
10
  import { compareStrictSemVer, parseStrictSemVer } from './semver.mjs';
11
11
  import { assertAuthoringPluginPathFence, resolveAuthoringPluginRoot, } from './plugin-root.mjs';
12
12
  const execFileAsync = promisify(execFile);
13
- const EXPECTED_MANIFEST_CONTRACT_VERSION = 17;
13
+ const EXPECTED_MANIFEST_CONTRACT_VERSION = 18;
14
14
  const PLUGIN_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
15
15
  const GIT_OBJECT_ID_PATTERN = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u;
16
16
  const MAX_GIT_BLOB_BYTES = 50 * 1024 * 1024;
@@ -6,7 +6,7 @@ import { createRequire } from 'node:module';
6
6
  import * as os from 'node:os';
7
7
  import * as path from 'node:path';
8
8
  import { fileURLToPath, pathToFileURL } from 'node:url';
9
- import { AW_RUNTIME_CONFIG_READER_PATH, createRuntimeConfigSnapshot, getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, getManagedCommandArtifactTargets, normalizePluginConfigDefinition, parseManagedCommandPlaceholders, replaceManagedCommandPlaceholders, validateCommandEntryFiles, } from '@lesliechan721/aw-plugin-core/manifest';
9
+ import { AW_RUNTIME_CONFIG_READER_PATH, createNativeToolReaderSource, createRuntimeConfigSnapshot, getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, getManagedCommandArtifactTargets, normalizePluginConfigDefinition, parseManagedCommandPlaceholders, replaceManagedCommandPlaceholders, validateCommandEntryFiles, } from '@lesliechan721/aw-plugin-core/manifest';
10
10
  import { checkPluginVersions } from './lib/plugin-version-check.mjs';
11
11
  import { scanJavaScriptImportSpecifiers } from './lib/javascript-import-scanner.mjs';
12
12
  import { assertAuthoringPluginPathFence, assertCanonicalAuthoringPluginRoot, } from './lib/plugin-root.mjs';
@@ -18,7 +18,7 @@ const CLI_PACKAGE_ROOT = path.basename(authoringRuntimeRoot) === 'dist'
18
18
  : authoringRuntimeRoot;
19
19
  const errors = [];
20
20
  const warnings = [];
21
- const SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION = 17;
21
+ const SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION = 18;
22
22
  let capabilityDiagnostic = null;
23
23
  const MAX_SKILL_NAME_LEN = 64;
24
24
  const MAX_SKILL_DESCRIPTION_LEN = 1024;
@@ -1645,6 +1645,8 @@ function scanNodeImportContract(pluginDir, entryPaths, options) {
1645
1645
  }
1646
1646
  if (!resolved.path) {
1647
1647
  const requested = path.posix.normalize(path.posix.join(path.posix.dirname(relativePath), specifier));
1648
+ if (options.nativeToolReader && requested === options.nativeToolReader)
1649
+ continue;
1648
1650
  if ((options.runtimeConfigSkillRoots ?? []).some((root) => (relativePath.startsWith(`${root}/`)
1649
1651
  && requested === path.posix.join(root, AW_RUNTIME_CONFIG_READER_PATH))))
1650
1652
  continue;
@@ -2918,8 +2920,20 @@ async function validateAuthorManagedCommands(pluginDir, manifest, rendered, cont
2918
2920
  const sets = (manifest.managedCommands?.sets ?? [])
2919
2921
  .filter((set) => set.producer.kind === 'package' && set.producer.packageKey === commandPackage.key)
2920
2922
  .map((set) => setOutputs(set, 'managed-commands', commandPackage.scope));
2921
- const files = rendered.find((entry) => entry.artifact.id === `command-package.${commandPackage.key}`)?.artifact.files ?? {};
2922
- const prepared = await tools.prepareManagedCommandPackageFiles({ sourceRoot: path.join(pluginDir, normalizeRelativePath(commandPackage.sourceDir)), files, entries: sets.flatMap((set) => set.entries) });
2923
+ const sourceRoot = path.join(pluginDir, normalizeRelativePath(commandPackage.sourceDir));
2924
+ const files = { ...(rendered.find((entry) => entry.artifact.id === `command-package.${commandPackage.key}`)?.artifact.files ?? {}) };
2925
+ if (manifest.nativeTools) {
2926
+ const readerPath = path.join(pluginDir, normalizeRelativePath(manifest.nativeTools.reader));
2927
+ const relativeReader = path.relative(sourceRoot, readerPath);
2928
+ if (relativeReader && relativeReader !== '..' && !relativeReader.startsWith(`..${path.sep}`) && !path.isAbsolute(relativeReader) && !fs.existsSync(readerPath)) {
2929
+ const readerFile = relativeReader.split(path.sep).join('/');
2930
+ const readerSource = createNativeToolReaderSource();
2931
+ if (Object.hasOwn(files, readerFile) && files[readerFile] !== readerSource)
2932
+ throw new Error('nativeToolReaderMismatch');
2933
+ files[readerFile] = readerSource;
2934
+ }
2935
+ }
2936
+ const prepared = await tools.prepareManagedCommandPackageFiles({ sourceRoot, files, entries: sets.flatMap((set) => set.entries) });
2923
2937
  cleanups.push(prepared.cleanup);
2924
2938
  candidates.push({ producer: await tools.managedCommandProducerIdentity({ plugin, producer: { kind: 'package', packageKey: commandPackage.key }, scope: commandPackage.scope, cwd: pluginDir }), sets });
2925
2939
  }
@@ -2994,6 +3008,7 @@ function validateScriptsLightweight(pluginDir, manifest) {
2994
3008
  const runtimeNodeEntries = [];
2995
3009
  let artifactRenderEntry = null;
2996
3010
  let packageMeta = null;
3011
+ const nativeToolReader = manifest.nativeTools ? normalizeRelativePath(manifest.nativeTools.reader ?? './.aw/native-tool-reader.mjs') : undefined;
2997
3012
  const runtimeConfigSkillRoots = (manifest.artifacts?.targets ?? [])
2998
3013
  .filter((target) => target.runtimeConfig !== undefined)
2999
3014
  .flatMap((target) => target.sourceDirs ?? [])
@@ -3046,6 +3061,7 @@ function validateScriptsLightweight(pluginDir, manifest) {
3046
3061
  packageMeta,
3047
3062
  allowDevDependencies: true,
3048
3063
  runtimeConfigSkillRoots,
3064
+ nativeToolReader,
3049
3065
  });
3050
3066
  }
3051
3067
  }
@@ -3096,6 +3112,7 @@ function validateScriptsLightweight(pluginDir, manifest) {
3096
3112
  packageMeta,
3097
3113
  allowDevDependencies: true,
3098
3114
  runtimeConfigSkillRoots,
3115
+ nativeToolReader,
3099
3116
  });
3100
3117
  }
3101
3118
  }
@@ -3106,6 +3123,7 @@ function validateScriptsLightweight(pluginDir, manifest) {
3106
3123
  packageMeta,
3107
3124
  allowDevDependencies: false,
3108
3125
  runtimeConfigSkillRoots,
3126
+ nativeToolReader,
3109
3127
  });
3110
3128
  return artifactRenderEntry;
3111
3129
  }