Skip to main content

Built and signed on GitHub Actions

Works with
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
•JSR Score100%•
License
Apache-2.0
•
Downloads141/wk
•
Publisheda day ago (0.0.10)

The NetScript command surface: scaffold a workspace, then grow it — contracts, services, databases, plugins, Fresh UI, deployment — with verbs that regenerate the derived wiring for you.

Examples

Create an embeddable NetScript CLI command tree.

import { createPublicCli } from "@netscript/cli";

const cli = createPublicCli({
  cwd: () => "/workspace/app",
  resolvePath: (path = ".") => `/workspace/app/${path}`,
});

Functions

f
createPluginHostLoader(options: PluginHostLoaderOptions): PluginHostLoaderPort

Create a plugin host loader from structural public ports.

f
createPublicCli(host: PublicCliHost): PublicCliCommand

Create the public NetScript CLI command tree.

f
dispatchPluginVerb(
verb: FrameworkVerb,
pkg: string,
args: readonly string[],
options: DispatchPluginVerbOptions
): Promise<PluginDispatchProcessResult>

Dispatch a framework plugin verb through deno x -A jsr:<pkg>/cli.

f
generateServiceClients(
request: GenerateServiceClientsRequest,
dependencies: GenerateServiceClientsDependencies
): Promise<GenerateServiceClientsResult>

Validate, plan, and reconcile every manifest service client.

f
inspectCli(target?: CliInspectionTarget): CliInspectionReport

Inspect an embeddable CLI target for diagnostics.

f
isFrameworkVerb(value: string): value is FrameworkVerb

Return whether a value is a framework-owned plugin verb.

f
resolvePluginCliSpecifier(pkg: string): string

Resolve the JSR CLI specifier for a plugin package.

f
resolvePluginManifest(
spec: string,
options: ResolvePluginManifestOptions
): Promise<PluginHostManifest>

Resolve a plugin manifest by package spec.

f
runPublicCli(runtime: PublicCliRuntime): Promise<void>

Run the public CLI with consistent error formatting.

f
scaffoldPluginPackage(
options: PluginScaffoldOptions,
dependencies: PluginScaffoldDependencies
): Promise<PluginScaffoldResult>

Scaffold a plugin package from skeleton templates.

Interfaces

I

Diagnostic summary for an embeddable CLI target.

  • hasParse: boolean

    Whether the target exposes a parse function.

  • summary: string

    Human-readable diagnostic summary.

I

Target accepted by inspectCli.

  • command: PublicCliCommand

    Optional command tree to inspect.

I

Options for dispatching a plugin verb.

  • processRunner: { exec(
    command: string,
    args: readonly string[],
    options?: { readonly cwd?: string; readonly env?: Readonly<Record<string, string>>; }
    ): Promise<PluginDispatchProcessResult>; }

    Process runner used to invoke Deno.

  • projectRoot: string

    Project root used as the subprocess working directory.

I

Dependencies for manifest-owned service-client generation.

  • clientScaffolder: { plan(
    projectRoot: string,
    projectName: string,
    serviceName: string
    ): Promise<
    { readonly serviceName: string; readonly path: string; readonly content: string; }
    >
    ; needsWrite(
    plan: { readonly serviceName: string; readonly path: string; readonly content: string; },
    force: boolean
    ): Promise<boolean>; write(plan: { readonly serviceName: string; readonly path: string; readonly content: string; }): Promise<void>; }

    Canonical client-module planner and writer.

  • readProjectName: (projectRoot: string) => Promise<string>

    Resolve the project scope used by generated contract imports.

  • serviceResolver: { discoverServices(projectRoot: string): Promise<readonly { readonly name: string; }[]>; }

    Sorted manifest service discovery.

I

Request for reconciling manifest-owned service client modules.

  • dryRun: boolean

    Report the complete plan without writing files.

  • force: boolean

    Rewrite identical generated files.

  • projectRoot: string

    Absolute project root.

I

Deterministic result from service-client generation.

  • dryRun: boolean

    Whether this invocation intentionally withheld writes.

  • planned: readonly PlannedServiceClientFile[]

    Fully validated output plan in manifest order.

  • skipped: readonly string[]

    Paths already current and therefore skipped.

  • written: readonly string[]

    Paths actually written; empty for a dry run.

I

One planned service-client output and whether it needs a write.

  • content: string

    Rendered TypeScript module.

  • path: string

    Generator-owned output path.

  • serviceName: string

    Manifest service name.

  • willWrite: boolean

    Whether current content requires reconciliation.

I

Result of a public process dispatch.

  • code: number

    Process exit code.

  • stderr: string

    Captured standard error.

  • stdout: string

    Captured standard output.

I

Plugin host loader contracts.

  • configLoader: { load(projectRoot: string): Promise<Readonly<Record<string, unknown>>>; }

    Config loader for netscript.config.ts.

  • emitter: { emit(contributions: readonly unknown[]): Promise<unknown>; }

    Emitter used by the walker pipeline.

  • extractor: { extract(files: readonly unknown[]): Promise<readonly unknown[]>; }

    Extractor used to read contributions from walked files.

  • fs: unknown

    Filesystem adapter reserved for host-side template expansion.

  • manifestResolver: { resolve(spec: string): Promise<PluginHostManifest | undefined>; }

    Manifest resolver used for configured plugin specs.

  • projectRoot: string

    Project root for configuration and walker operations.

  • walker: { walk(root: string): Promise<readonly unknown[]>; }

    Walker used to discover plugin source files.

I

Public host loader port.

  • resolve(): Promise<PluginHostState>

    Resolve the current plugin host state.

I

Plugin manifest value returned by public host loader contracts.

  • contributions: unknown

    Runtime contribution payload owned by the plugin package.

  • description: string

    Optional human-readable description.

  • name: string

    Plugin package name.

  • version: string

    Plugin semantic version.

I

Resolved plugin host state.

  • config: Readonly<Record<string, unknown>>

    Loaded project configuration.

  • contributions: unknown

    Merged contribution payload.

  • emissions: readonly unknown[]

    Registry emissions produced by the walker.

  • plugins: readonly PluginHostManifest[]

    Resolved plugin manifests.

I

Dependencies for plugin package scaffolding.

  • fs: { readFile(path: string): Promise<string>; writeFile(
    path: string,
    content: string
    ): Promise<void>; exists(path: string): Promise<boolean>; createDir(path: string): Promise<void>; }

    Filesystem adapter used by the scaffold use case.

I

Options for scaffolding a plugin package.

  • overwrite: boolean

    Whether existing files may be overwritten.

  • pluginName: string

    Full plugin package name, for example @acme/plugin-billing.

  • targetPath: string

    Directory that receives generated files.

  • templateContent: Readonly<Record<string, string>>

    Optional embedded template content keyed by registry path.

  • templateRegistry: readonly string[]

    Optional template path registry.

I

Result returned after plugin package scaffolding.

  • directoriesCreated: readonly string[]

    Directories created by the scaffold use case.

  • filesCreated: readonly string[]

    Files written by the scaffold use case.

  • filesSkipped: readonly string[]

    Files skipped because overwrite was disabled.

I

Public command tree returned by createPublicCli.

  • getVersion: () => string | undefined

    Return the command version printed by --version.

  • parse: (args?: string[]) => Promise<unknown> | unknown

    Parse command-line arguments.

I

Host services supplied by the binary edge.

  • cwd: () => string

    Return the current working directory.

  • resolvePath: (path?: string) => string

    Resolve a path from the current working directory.

I

Runtime hooks supplied by the public CLI binary.

  • args: readonly string[]

    Raw CLI arguments.

  • error: (message: string) => void

    Write an error line.

I

Options for resolving a plugin manifest.

  • manifestResolver: { resolve(spec: string): Promise<PluginHostManifest | undefined>; }

    Manifest resolver used to resolve the package spec.

Type Aliases

T
FrameworkVerb =
"install"
| "remove"
| "enable"
| "disable"
| "sync"
| "setup"
| "update"
| "doctor"
| "info"

Framework-owned plugin verbs.

Variables

v
FRAMEWORK_VERBS: readonly FrameworkVerb[]

Framework-owned plugin verb constants.