### Setup: Install and Load Tree-sitter via NPM
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/web-tree-sitter/README.md
Shows how to install the web-tree-sitter module using npm and initialize the parser, suitable for module bundlers like Webpack.
```javascript
const Parser = require('web-tree-sitter');
Parser.init().then(() => { /* the library is ready */ });
```
--------------------------------
### Install mkdirp with npm
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/mkdirp/readme.markdown
Instructions for installing the `mkdirp` package locally for project use or globally for command-line access. Also shows how to execute the command without global installation using `npx`.
```shell
npm install mkdirp
npm install -g mkdirp
npx mkdirp ...
```
--------------------------------
### Install with External SQLite3
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/README.md
Builds the sqlite3 module against an externally installed libsqlite3. Requires development headers for the external library. The `--sqlite` argument specifies the installation prefix.
```bash
npm install --build-from-source --sqlite=/usr/local
```
```bash
npm install --build-from-source --sqlite=/usr/local/opt/sqlite/
```
--------------------------------
### Install node-sqlite3 with npm or yarn
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/README.md
Instructions for installing the node-sqlite3 package using either npm or yarn. This includes the recommended method for the latest published package and an alternative for installing directly from GitHub's master branch.
```bash
npm install sqlite3
# or
yarn add sqlite3
```
```bash
npm install https://github.com/tryghost/node-sqlite3/tarball/master
```
--------------------------------
### Build Process Commands
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/README.md
Outlines the essential npm commands required to build the agent, including installation, pre-testing, and publishing. These commands ensure both x86 and x64 N-API versions are built, along with a standalone utility for older Node.js versions.
```bash
npm install
npm run pretest
npm run [nvm$]
npm publish
```
--------------------------------
### Clone and Install Workerpool Dependencies
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/workerpool/README.md
Clones the workerpool repository from GitHub and installs its project dependencies using npm. This is the initial setup step.
```shell
git clone git://github.com/josdejong/workerpool.git
cd workerpool
npm install
```
--------------------------------
### Install node-bindings
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/bindings/README.md
Installs the node-bindings module using npm. This command should be run in your project's root directory.
```bash
$ npm install --save bindings
```
--------------------------------
### Setup: Load Tree-sitter with Deno
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/web-tree-sitter/README.md
Illustrates how to import and initialize the Tree-sitter parser when using the Deno runtime environment.
```javascript
import Parser from "npm:web-tree-sitter";
await Parser.init();
// the library is ready
```
--------------------------------
### Basic node-sqlite3 Usage Example
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/README.md
A fundamental JavaScript example demonstrating how to use the node-sqlite3 module. It covers connecting to an in-memory database, creating a table, inserting data using prepared statements, and querying data with iteration.
```javascript
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database(':memory:');
db.serialize(() => {
db.run("CREATE TABLE lorem (info TEXT)");
const stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (let i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();
db.each("SELECT rowid AS id, info FROM lorem", (err, row) => {
console.log(row.id + ": " + row.info);
});
});
db.close();
```
--------------------------------
### Install node-addon-api
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/node-addon-api/tools/README.md
Installs the necessary node-addon-api package, a prerequisite for running the migration script.
```bash
npm install node-addon-api
```
--------------------------------
### Install Dependencies
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/README.md
Installs the necessary project dependencies using npm. This is a prerequisite for building and running the extension.
```shell
npm install
```
--------------------------------
### Setup: Load Tree-sitter via HTML Script
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/web-tree-sitter/README.md
Demonstrates how to include the Tree-sitter JavaScript library using a script tag and initialize the parser in a browser environment.
```html
```
--------------------------------
### Basic Source Install for sqlite3
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/README.md
Forces the sqlite3 module to build from source, skipping pre-compiled binary searches. This is the base command for custom builds.
```bash
npm install --build-from-source
```
--------------------------------
### Basic Minipass Tee-Stream Setup
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minizlib/node_modules/minipass/README.md
Demonstrates the fundamental setup of a Minipass stream piping to multiple destinations. Data written to the source stream is immediately processed by all piped destinations.
```js
const Minipass = require('minipass');
const tee = new Minipass();
t.pipe(dest1);
t.pipe(dest2);
t.write('foo'); // goes to both destinations
```
--------------------------------
### Install ONNX Runtime Node.js Binding from Source
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/onnxruntime-node/README.md
Installs the ONNX Runtime Node.js binding by building it from the source code repository. This method is useful for development or when pre-built binaries are unavailable for your specific platform.
```bash
npm install /js/node/
```
--------------------------------
### Basic Installation and Usage
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/README.md
Installs the win-ca package via npm and demonstrates the simplest way to require it, which automatically makes system root certificates available for Node.js HTTPS requests.
```bash
npm install --save win-ca
```
```javascript
const ca = require('win-ca');
// win-ca automatically fetches and applies certificates to https.globalAgent.options.ca
```
--------------------------------
### Install file-uri-to-path using npm
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/file-uri-to-path/README.md
This snippet shows how to install the `file-uri-to-path` package using the Node Package Manager (npm). It's a standard command-line installation for Node.js modules, making the utility available for use in your projects.
```bash
npm install file-uri-to-path
```
--------------------------------
### Install ONNX Runtime Node.js Binding
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/onnxruntime-node/README.md
Installs the latest stable version of the ONNX Runtime Node.js binding using npm. This is the standard method for integrating the library into your Node.js project.
```bash
npm install onnxruntime-node
```
--------------------------------
### Running Node-addon-api Tests
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/node-addon-api/README.md
Commands to install dependencies and run tests for node-addon-api. Includes options to disable deprecated features or target specific Node-API versions.
```Shell
npm install
npm test
```
```Shell
npm install
npm test --disable-deprecated
```
```Shell
npm install
export NAPI_VERSION=X
npm test --NAPI_VERSION=X
```
--------------------------------
### Install make-dir using npm
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/node_modules/make-dir/readme.md
Installs the make-dir package from npm. This command adds the module to your project's dependencies, making it available for use in your Node.js applications.
```bash
npm install make-dir
```
--------------------------------
### Build for Node-Webkit
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/README.md
Configures the sqlite3 module to be compatible with Node-Webkit. Requires installing `nw-gyp` globally and specifying runtime, target architecture, and target version. Builds for Node-Webkit are not compatible with vanilla Node.js.
```bash
npm install nw-gyp -g
NODE_WEBKIT_VERSION="0.8.6"
npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
```
```bash
npm install --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
```
--------------------------------
### Basic Minipass Tee Stream Setup
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minipass/README.md
Demonstrates the fundamental setup of a Minipass tee stream, where a single stream is piped to multiple destinations. Data written to the tee stream is immediately forwarded to all piped destinations.
```js
const tee = new Minipass()
t.pipe(dest1)
t.pipe(dest2)
t.write('foo') // goes to both destinations
```
--------------------------------
### Build for SQLCipher (OS X Homebrew)
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/README.md
Builds sqlite3 with SQLCipher when SQLCipher is installed via Homebrew on macOS. Sets environment variables for linker and compiler flags to point to the Homebrew installation path.
```bash
export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib"
export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include/sqlcipher"
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix`
node -e 'require("sqlite3")'
```
--------------------------------
### Fetch Certificates from Multiple Stores
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/README.md
Demonstrates how to fetch certificates from both 'root' and 'ca' Windows certificate stores and populate a list with the results.
```javascript
var list = []
require('win-ca/api')({store: ['root', 'ca'], ondata: list})
```
--------------------------------
### Build Extension
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/README.md
Compiles the extension code, preparing it for development or deployment. This command is part of the standard development setup.
```shell
npm run compile
```
--------------------------------
### Basic Usage: Inspect Syntax Tree
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/web-tree-sitter/README.md
Provides examples of how to inspect the generated syntax tree, including printing the entire tree structure and accessing specific nodes like call expressions.
```javascript
console.log(tree.rootNode.toString());
// (program
// (lexical_declaration
// (variable_declarator (identifier) (number)))
// (expression_statement
// (call_expression
// (member_expression (identifier) (property_identifier))
// (arguments (identifier)))))
const callExpression = tree.rootNode.child(1).firstChild;
console.log(callExpression);
```
```javascript
// { type: 'call_expression',
// startPosition: {row: 0, column: 16},
// endPosition: {row: 0, column: 30},
// startIndex: 0,
// endIndex: 30 }
```
--------------------------------
### Build for SQLCipher (Basic)
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/README.md
Compiles the sqlite3 module to use SQLCipher instead of the default SQLite. Requires SQLCipher to be installed and accessible via standard library paths.
```bash
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/
node -e 'require("sqlite3")'
```
--------------------------------
### Basic Minipass Stream Usage
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minizlib/node_modules/minipass/README.md
Provides a fundamental example of how to use a Minipass stream, including requiring the module, creating an instance, writing data, piping to another stream, and ending the stream.
```js
const Minipass = require('minipass');
const mp = new Minipass(options); // optional: { encoding, objectMode }
mp.write('foo');
mp.pipe(someOtherStream);
mp.end('bar');
```
--------------------------------
### Minipass Subclassing Example
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minipass/README.md
Provides an example of subclassing Minipass to add custom behavior, such as logging write and end operations. This demonstrates how to extend stream functionality.
```javascript
class Logger extends Minipass {
write(chunk, encoding, callback) {
console.log('WRITE:', chunk, encoding);
// Call the parent class's write method to ensure normal stream operation
return super.write(chunk, encoding, callback);
}
end(chunk, encoding, callback) {
console.log('END:', chunk, encoding);
// Call the parent class's end method
return super.end(chunk, encoding, callback);
}
}
// Example usage with piping:
// const someSource = new Minipass();
// const someDest = new Minipass();
// someSource.pipe(new Logger()).pipe(someDest);
// someSource.write('test data');
// someSource.end();
```
--------------------------------
### Hook System Configuration Schema
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/README.md
Example JSON schema for configuring automation hooks, demonstrating how file events can trigger agent actions.
```JSON
{
"hooks": [
{
"type": "FileEditedHook",
"filePattern": "*.js",
"action": {
"type": "AskAgentHook",
"message": "Review this JavaScript file for potential issues"
}
}
]
}
```
--------------------------------
### Build for SQLCipher (Linux)
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/README.md
Builds sqlite3 with SQLCipher on Linux systems, assuming SQLCipher was compiled and installed to /usr/local. Sets environment variables for linker and compiler flags to include the custom SQLCipher paths.
```bash
export LDFLAGS="-L/usr/local/lib"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/sqlcipher"
export CXXFLAGS="$CPPFLAGS"
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/local --verbose
node -e 'require("sqlite3")'
```
--------------------------------
### Minipass Promise-based Completion
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minipass/README.md
Demonstrates how to use the `promise()` method to get a Promise that resolves when the stream finishes or rejects if an error occurs.
```javascript
const mp = new Minipass();
mp.promise().then(
() => {
// Stream has finished successfully
console.log('Stream finished');
},
er => {
// Stream emitted an error
console.error('Stream error:', er);
}
);
// ... write data to mp and eventually call mp.end()
```
--------------------------------
### Minipass Synchronous Behavior Example
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minizlib/node_modules/minipass/README.md
Demonstrates the synchronous data emission behavior of Minipass streams when `async: true` is set in the constructor options. It shows how data is emitted immediately upon writing, unlike Node.js core streams which might defer events.
```javascript
const Minipass = require('minipass')
const stream = new Minipass({ async: true })
stream.on('data', () => console.log('data event'))
console.log('before write')
stream.write('hello')
console.log('after write')
// output:
// before write
// data event
// after write
```
--------------------------------
### Demonstrate Node.js Stream Buffering
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minizlib/node_modules/minipass/README.md
Illustrates how Node.js PassThrough streams buffer data when backpressure is applied, leading to deferred writes and multiple event deferrals. This example highlights the potential for significant buffering across a pipeline.
```javascript
const {PassThrough} = require('stream')
const p1 = new PassThrough({ highWaterMark: 1024 })
const p2 = new PassThrough({ highWaterMark: 1024 })
const p3 = new PassThrough({ highWaterMark: 1024 })
const p4 = new PassThrough({ highWaterMark: 1024 })
p1.pipe(p2).pipe(p3).pipe(p4)
p4.on('data', () => console.log('made it through'))
// this returns false and buffers, then writes to p2 on next tick (1)
// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2)
// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3)
// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain'
// on next tick (4)
// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and
// 'drain' on next tick (5)
// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6)
// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next
// tick (7)
p1.write(Buffer.alloc(2048)) // returns false
```
--------------------------------
### Create AI Agent Hook Prompt
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/prompts/hook-creation.md
This prompt guides an AI agent to create a 'hook' configuration file. A hook maps file edit operations to AI agent requests, based on a user-provided prompt. The agent is instructed to output only the hook and a confirmation message.
```text
# Hook Creation Prompt
**Workflow Stage:** Hook Creation
```
# Overview
You are a Software engineering AI Agent who's job is to construct what we call a "hook".
You are managed by an autonomous process which takes your ouput, performs the actions you requested, and is supervised by a human user.
Specifically the user is asking you to build a hook with the following description. This is your most important goal for this entire chat session.
{{prompt}}
## What is a hook?
You may be wondering what a hook is? A hook is a config file which describes a mapping between file edit operations and agent operations.
Loosely they detail the following:
- What file events to listen to
- What request to send to the AI Agent when these file events occur
You have one tool available to you, use it to create a hook which aligns with the user's requests.
Please just use the tool, dont give a long winded explanation to the user. The chat itself is hidden to them so they are only going to see the hook output itself.
Conclude by telling the user that the hook has been created.
```
```
--------------------------------
### Get Tarball Filenames Synchronously
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/tar/README.md
An example function to retrieve all filenames from a tarball synchronously. It uses tar.t with 'sync: true' and an 'onentry' callback.
```javascript
const getEntryFilenamesSync = tarballFilename => {
const filenames = []
tar.t({
file: tarballFilename,
onentry: entry => filenames.push(entry.path),
sync: true,
})
return filenames
}
```
--------------------------------
### Get Tarball Filenames Asynchronously
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/tar/README.md
An example function to retrieve all filenames from a tarball asynchronously. It uses tar.t with an 'onentry' callback to collect paths.
```javascript
const getEntryFilenames = async tarballFilename => {
const filenames = []
await tar.t({
file: tarballFilename,
onentry: entry => filenames.push(entry.path),
})
return filenames
}
```
--------------------------------
### Running Node-addon-api Benchmarks
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/node-addon-api/README.md
Command to execute the benchmarks for the node-addon-api library. Refer to benchmark/README.md for more details.
```Shell
npm run-script benchmark
```
--------------------------------
### Install Transformers.js
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/models/all-MiniLM-L6-v2/README.md
Installs the Transformers.js JavaScript library from NPM, which is required to use the model for computations.
```bash
npm i @xenova/transformers
```
--------------------------------
### Build Commands
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/readme.original.md
Lists the primary npm scripts used for building, packaging, and releasing the Kiro extension. These commands automate compilation, code bundling, and final packaging processes.
```bash
npm run compile
npm run package
npm run release
npm run analyze-externals
```
--------------------------------
### Napi::ObjectWrap Constructor and Initialization
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/node-addon-api/tools/README.md
Demonstrates the correct way to define a constructor for Napi::ObjectWrap and initialize class methods and accessors in C++ for Node.js addons.
```cpp
// Constructor definition
[ClassName](const Napi::CallbackInfo& info) : Napi::ObjectWrap<[ClassName]>(info) {
// Original constructor code moved here
}
// Class initialization function
void [ClassName]::Init(Napi::Env env, Napi::Object exports, Napi::Object module) {
Napi::HandleScope scope(env);
Napi::Function ctor = DefineClass(env, "Canvas", {
InstanceMethod<&[ClassName]::Func1>("Func1"),
InstanceMethod<&[ClassName]::Func2>("Func2"),
InstanceAccessor<&[ClassName]::ValueGetter>("Value"),
StaticMethod<&[ClassName]::StaticMethod>("MethodName"),
InstanceValue("Value", Napi::[Type]::New(env, value))
});
constructor = Napi::Persistent(ctor);
constructor.SuppressDestruct();
exports.Set("[ClassName]", ctor);
}
```
--------------------------------
### make-dir API Documentation
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/node_modules/make-dir/readme.md
Documentation for the `make-dir` module, covering its primary asynchronous and synchronous methods, parameters, and options.
```APIDOC
makeDir(path, [options])
Returns a Promise for the path to the created directory.
makeDir.sync(path, [options])
Returns the path to the created directory.
Parameters:
path (string): Directory to create.
Options:
mode (integer): Default: `0o777 & (~process.umask())`. Directory permissions.
fs (Object): Default: `require('fs')`. Use a custom `fs` implementation, e.g., `graceful-fs`.
```
--------------------------------
### Launch VS Code with Extension
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/README.md
Launches an instance of Visual Studio Code with the extension loaded and ready for debugging. This is typically done after building the extension.
```shell
F5
```
--------------------------------
### Kiro Agent Extension Entry Point and Lifecycle
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/README.md
Describes the main entry point and activation lifecycle of the Kiro Agent VS Code extension. It outlines the sequence of function calls from the main bundle to the extension activation.
```text
Main bundle: [`dist/extension.js`](file:///Users/ghuntley/Desktop/kiro.kiro-agent/dist/extension.js)
Activation lifecycle: `activate()` → `dynamicImportAndActivate()` → `activateExtension()`
Command registry: 52 commands with comprehensive VS Code integration
```
--------------------------------
### Basic Usage: Parse Source Code
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/web-tree-sitter/README.md
Covers the fundamental steps of creating a parser instance, loading a language WASM file, setting it on the parser, and parsing a string of source code.
```javascript
const parser = new Parser;
const JavaScript = await Parser.Language.load('/path/to/tree-sitter-javascript.wasm');
parser.setLanguage(JavaScript);
const sourceCode = 'let x = 1; console.log(x);';
const tree = parser.parse(sourceCode);
```
--------------------------------
### mkdirp CLI Usage and Options
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/mkdirp/readme.markdown
Details the command-line interface for `mkdirp`, outlining its primary function to create directories recursively. It specifies available options for setting permissions, printing version/help information, displaying created directories, and forcing manual implementation.
```APIDOC
mkdirp -h
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
Create each supplied directory including any necessary parent directories
that don't yet exist.
If the directory already exists, do nothing.
OPTIONS are:
-m If a directory needs to be created, set the mode as an octal
--mode= permission string.
-v --version Print the mkdirp version number
-h --help Print this helpful banner
-p --print Print the first directories created for each path provided
--manual Use manual implementation, even if native is available
```
--------------------------------
### Legacy API: Get All Certificates
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/README.md
Retrieves all certificates from the Root store. This legacy method deduplicates certificates and returns them in node-forge's format by default. It can accept a format parameter to handle potential issues with non-RSA certificates.
```javascript
var ca = require('win-ca');
// Get all certificates in PEM format
var allCerts = ca.all(ca.der2.pem);
// Example usage:
do.something.with(ca.all(ca.der2.pem));
```
--------------------------------
### Run Tests
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/README.md
Executes the test suite for the sqlite3 module.
```bash
npm test
```
--------------------------------
### Async Directory Creation
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/mkdirp/readme.markdown
Demonstrates how to use mkdirp asynchronously to create a nested directory structure. The promise resolves with the first directory that was made.
```javascript
const mkdirp = require('mkdirp')
// return value is a Promise resolving to the first directory created
mkdirp('/tmp/foo/bar/baz').then(made =>
console.log(`made directories, starting with ${made}`))
```
--------------------------------
### Kiro Agent Build Commands
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/README.md
Provides essential bash commands for managing the Kiro agent's build process. These commands cover compiling code, packaging the extension, performing full releases, and analyzing external dependencies.
```bash
npm run compile # Build all components
npm run package # Compile code only
npm run release # Full build with packaging
npm run analyze-externals # Update dependencies
```
--------------------------------
### tar.Pack Constructor Options
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/tar/README.md
Supported options for configuring the tar.Pack stream, including archive creation settings and event handlers.
```APIDOC
constructor(options)
Supported options:
- `onwarn`: A function called with `(code, message, data)` for warnings.
- `strict`: Treat warnings as errors. Default: false.
- `cwd`: Current working directory for archive creation. Default: `process.cwd()`.
- `prefix`: Path portion to prefix onto archive entries.
- `gzip`: Create a gzipped archive. Can be truthy or an object for `zlib.Gzip()` settings.
- `filter`: Function `(path, stat)` to include/omit entries. Return `true` to add.
- `portable`: Omit system-specific metadata (`ctime`, `atime`, `uid`, `gid`, etc.). `mtime` is still included.
- `preservePaths`: Allow absolute paths. Strips `/` from absolute paths by default.
- `linkCache`: Map object for hard link identification using device/inode.
- `statCache`: Map object to cache `lstat` calls.
- `readdirCache`: Map object to cache `readdir` calls.
- `jobs`: Number of concurrent jobs. Default: 4.
- `maxReadSize`: Max buffer size for `fs.read()` operations. Default: 16 MB.
- `noDirRecurse`: Do not recursively archive directory contents.
- `follow`: Pack targets of symbolic links. Default: archive links as such.
- `noPax`: Suppress pax extended headers. May truncate long paths/linkpaths.
```
--------------------------------
### Basic yallist Usage
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/yallist/README.md
Demonstrates creating a yallist, adding elements, and using common methods like toArray, forEach, and map.
```javascript
var yallist = require('yallist')
var myList = yallist.create([1, 2, 3])
myList.push('foo')
myList.unshift('bar')
// of course pop() and shift() are there, too
console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo']
myList.forEach(function (k) {
// walk the list head to tail
})
myList.forEachReverse(function (k, index, list) {
// walk the list tail to head
})
var myDoubledList = myList.map(function (k) {
return k + k
})
// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo']
// mapReverse is also a thing
var myDoubledListReverse = myList.mapReverse(function (k) {
return k + k
}) // ['foofoo', 6, 4, 2, 'barbar']
var reduced = myList.reduce(function (set, entry) {
set += entry
return set
}, 'start')
console.log(reduced) // 'startfoo123bar'
```
--------------------------------
### Iterate Certificates using Generator
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/README.md
Shows how to use the generator option to iterate over certificates directly, either synchronously or asynchronously.
```javascript
const ca = require('win-ca/api')
// Synchronous iteration
for (let der of ca({generator: true})) {
// Process(der)
}
// Or using spread syntax (Node.js v>=6)
let list = [...ca({generator: true})]
// Asynchronous iteration (Node.js v>=10)
for await(let der of ca({generator: true, async: true})) {
// await Process(der)
}
```
--------------------------------
### Kiro Template Factory System Overview
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/README.md
Provides an overview of the Kiro agent's template factory system, which handles model-specific prompt optimization and template compilation.
```APIDOC
TemplateFactorySystem:
Features:
- Automatic model detection via `autodetectPromptTemplates()`.
- Provider-specific handling (OpenAI, Anthropic, Ollama, etc.).
- Template compilation with Handlebars support.
- Message role management and formatting.
- Context-aware rendering with dynamic variables.
Available Edit Prompts:
- GPT Edit Prompt: For OpenAI GPT models.
- Claude Edit Prompt: For Anthropic Claude models.
- Mistral Edit Prompt: For Mistral models.
- DeepSeek Edit Prompt: For DeepSeek Coder models.
- Llama 3 Edit Prompt: For Llama 3 models.
- Alpaca Edit Prompt: For Alpaca models.
- Phind Edit Prompt: For Phind models.
- Zephyr Edit Prompt: For Zephyr models.
- OpenChat Edit Prompt: For OpenChat models.
- XWin-Coder Edit Prompt: For XWin-Coder models.
- Neural Chat Edit Prompt: For Neural Chat models.
- CodeLlama 70B Edit Prompt: For CodeLlama 70B models.
- Gemma Edit Prompt: For Gemma models.
- Simplified Edit Prompt: Generic fallback.
```
--------------------------------
### Import and Use Minipass Stream (JavaScript)
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minipass/README.md
Demonstrates how to import the Minipass stream class in JavaScript, instantiate a stream, attach a 'data' event listener, and write data to it. It illustrates the synchronous emission of data events.
```javascript
// hybrid module, either works
import { Minipass } from 'minipass'
// or:
const { Minipass } = require('minipass')
const stream = new Minipass()
stream.on('data', () => console.log('data event'))
console.log('before write')
stream.write('hello')
console.log('after write')
// output:
// before write
// data event
// after write
```
--------------------------------
### User Input Tool Usage
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/prompts/spec-implementation-plan.md
Details the specific command and reason for using the 'userInput' tool to get user approval on the generated task list.
```CLI
userInput('spec-tasks-review')
```
--------------------------------
### Configure .vscodeignore Manual Exceptions
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/readme.original.md
Defines manual exceptions in `.vscodeignore` to include specific packages or directories that are needed at runtime but not directly imported by the main extension code. This is crucial for packages with native binaries or dynamic loading.
```gitignore
# Keep dependencies of native binary packages
!node_modules/@lancedb/
!node_modules/@vscode/ripgrep/
```
--------------------------------
### Kiro Intent Classification System
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/README.md
Details the multi-modal intent detection system used by the Kiro agent, including classification strategies and prompt examples for intent recognition.
```APIDOC
IntentClassifier:
Description: Multi-Modal Intent Detection System
Classification Strategies:
- Local Rule-Based: Pattern matching for common intents.
- LLM-Based: Sophisticated intent detection with confidence scoring.
- Hybrid Approach: Combines local and LLM results with weighted scoring.
Intent Classification Prompt Example:
Classify the user's intent from their message:
- DO: Imperative actions (default mode)
- CHAT: Questions and explanations
- SPEC: Specification creation and management
Consider context, tone, and explicit keywords to determine intent.
Provide confidence scores for classification accuracy.
```
--------------------------------
### napi-rs for Rust Bindings
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/node-addon-api/README.md
Information about napi-rs, a project that enables writing Node.js native addons using Rust. It leverages Node-API for stability and performance.
```APIDOC
napi-rs:
URL: https://napi.rs
Description: A project for creating Node.js native addons with Rust, providing a high-performance and safe way to extend Node.js functionality.
```
--------------------------------
### Running Specific Node-addon-api Unit Tests
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/node-addon-api/README.md
Instructions for running specific unit tests using filters. Supports single tests, wildcard matching, and combining multiple filter conditions.
```Shell
npm run unit --filter=objectwrap
```
```Shell
npm run unit --filter=*reference
```
```Shell
npm run unit --filter='*function objectwrap'
```
--------------------------------
### Convert Certificate from DER Format
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/README.md
Converts a certificate from DER format to a specified output format. The function is curried, allowing partial application for creating format-specific converters.
```javascript
var certificate = ca.der2(format, certificate_in_der_format);
// Curried usage example:
var toPEM = ca.der2(ca.der2.pem);
var pem = toPEM(der);
```
--------------------------------
### Minipass Basic Usage and Constructor
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minipass/README.md
Shows the standard way to instantiate and use a Minipass stream, including writing data and piping it to another stream. It also mentions optional constructor arguments for configuration.
```js
import { Minipass } from 'minipass'
const mp = new Minipass(options) // optional: { encoding, objectMode }
mp.write('foo')
mp.pipe(someOtherStream)
mp.end('bar')
```
--------------------------------
### grepSearch Tool API
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/prompts/grep-search.md
Provides detailed information on how to use the grepSearch tool for efficient text-based regex pattern matching. It covers parameters, search behavior, valid pattern examples, and essential usage rules.
```APIDOC
grepSearch Tool:
Description: Fast text-based regex search that finds exact pattern matches within files or directories using ripgrep. Search results include line numbers, file paths, and 2 lines of context around each match.
Parameters:
query (string, required): The regex pattern to search for. Use Rust regex syntax.
caseSensitive (string, optional): "yes" for case-sensitive search, "no" or omit for case-insensitive.
includePattern (string, optional): Glob pattern for files to include (e.g. '*.ts', 'src/**/*.js'). If omitted, searches all files in workspace.
excludePattern (string, optional): Glob pattern for files to exclude (e.g. '*.log', 'node_modules/**').
explanation (string, optional): Brief description of why this search is being performed.
Search Behavior:
- Results are capped at 50 matches.
- Long lines are truncated with "[truncated: line too long]".
- If total output is too large, truncates with "[truncated: too many matches]" message.
Examples of VALID patterns:
- Basic text search: "function", "error", "TODO"
- Word boundaries: "\\bword\\b" (matches 'word' but not 'password')
- Multiple words: "auth.*failed"
- File content with spaces: "not found"
- Line starts with: "^import"
- Line ends with: "};$"
- Numbers: "\\d+\\.\\d+" (finds decimal numbers like 3.14)
- Word followed by another: "function\\s+\\w+" (finds function declarations)
Rules:
1. Keep regex patterns simple. Complex patterns may fail.
2. Use includePattern to narrow search scope for better performance.
3. Glob patterns: use standard glob syntax (* for wildcards, ** for recursive).
4. NEVER use bash command "grep" to search but use this search tool instead because it is optimized for your machine.
5. Always escape special regex characters: ( ) [ ] { } + * ? ^ $ | . \\.
6. You MUST use \\ to escape any of special regex characters when they appear in your search string.
```
--------------------------------
### Minipass Stream Options
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minizlib/node_modules/minipass/README.md
Details the available options for the Minipass constructor: `encoding` for output data encoding, `objectMode` for emitting data as-is, and `async` for deferring data emission to the next tick.
```APIDOC
Minipass Constructor Options:
- encoding: How would you like the data coming _out_ of the stream to be encoded? Accepts any values that can be passed to `Buffer.toString()`.
- objectMode: Emit data exactly as it comes in. This will be flipped on by default if you write() something other than a string or Buffer at any point. Setting `objectMode: true` will prevent setting any encoding value.
- async: Defaults to `false`. Set to `true` to defer data emission until next tick. This reduces performance slightly, but makes Minipass streams use timing behavior closer to Node core streams.
```
--------------------------------
### Enable Experimental Injection Method
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/README.md
Shows how to enable the experimental injection method for certificate handling. This can be an alternative approach to managing certificates, especially when dealing with OS-level certificate store behaviors.
```js
require('win-ca').inject('+')
```
--------------------------------
### Sync Directory Creation
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/mkdirp/readme.markdown
Shows the synchronous usage of mkdirp to create directories. The function returns the first directory that was created.
```javascript
const mkdirp = require('mkdirp')
// return value is the first directory created
const made = mkdirp.sync('/tmp/foo/bar/baz')
console.log(`made directories, starting with ${made}`)
```
--------------------------------
### Use N-API Fallback Engine
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/README.md
Demonstrates how to explicitly use the fallback engine for fetching certificate lists, even on modern Node.js versions. This is useful for specific testing or compatibility scenarios.
```js
require('win-ca/fallback')
```
--------------------------------
### Advanced API Usage
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/win-ca/README.md
Demonstrates how to use the win-ca API directly to fetch certificates in a specific format (PEM) and process them using a callback function. This allows for custom handling of the certificate data.
```javascript
const ca = require('win-ca');
let rootCAs = [];
// Fetch all certificates in PEM format and push them to an array
ca({
format: ca.der2.pem,
ondata: crt => rootCAs.push(crt)
});
// rootCAs array now contains certificates in PEM format
```
--------------------------------
### Generate .wasm Language Files: CLI Build
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/web-tree-sitter/README.md
Details the process of generating Tree-sitter language WASM files using the `tree-sitter-cli`. Requires emscripten, Docker, or Podman.
```shell
npm install --save-dev tree-sitter-cli tree-sitter-javascript
npx tree-sitter build --wasm node_modules/tree-sitter-javascript
```
--------------------------------
### Get Ripgrep Path in Node.js
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/@vscode/ripgrep/README.md
This snippet demonstrates how to import the ripgrep binary path from the 'vscode-ripgrep' module. The exported `rgPath` variable provides the absolute path to the ripgrep executable, which can then be used with Node.js's `child_process` module for spawning ripgrep processes.
```javascript
const { rgPath } = require('vscode-ripgrep');
// Example usage with child_process.spawn:
// const { spawn } = require('child_process');
// const rgProcess = spawn(rgPath, ['--files']);
```
--------------------------------
### tar.WriteEntry Constructor and Options
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/tar/README.md
Details the constructor for tar.WriteEntry, which takes a path and options object. It lists various supported options for controlling archive creation, metadata handling, and error reporting.
```APIDOC
class tar.WriteEntry
constructor(path, options)
path: The path of the entry as it is written in the archive.
options: An object containing configuration for the entry.
portable: Omit system-specific metadata (ctime, atime, uid, gid, uname, gname, dev, ino, nlink). mtime is still included.
maxReadSize: The maximum buffer size for fs.read() operations. Defaults to 1 MB.
linkCache: A Map object to identify hard links using device and inode values.
statCache: A Map object that caches lstat calls.
preservePaths: Allow absolute paths. By default, '/' is stripped from absolute paths.
cwd: The current working directory for creating the archive. Defaults to process.cwd().
absolute: The absolute path to the entry on the filesystem. Defaults to path.resolve(this.cwd, this.path).
strict: Treat warnings as crash-worthy errors. Default false.
win32: True if on a Windows platform. Replaces '\' with '/' in paths.
onwarn: A function called with (code, message, data) for warnings.
noMtime: Omit writing mtime values for entries. Prevents mtime-based features like tar.update or keepNewer.
umask: Restrict entry modes, similar to umask. Defaults to process.umask() on Unix, or 0o22 on Windows.
```
--------------------------------
### Minipass Streams Efficient Data Flow Example
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minipass/README.md
Shows how Minipass streams handle data immediately without buffering when flowing. Data is written directly through the pipeline, and the write operation returns true, indicating no backpressure and no event deferrals.
```js
const m1 = new Minipass()
const m2 = new Minipass()
const m3 = new Minipass()
const m4 = new Minipass()
m1.pipe(m2).pipe(m3).pipe(m4)
m4.on('data', () => console.log('made it through'))
// m1 is flowing, so it writes the data to m2 immediately
// m2 is flowing, so it writes the data to m3 immediately
// m3 is flowing, so it writes the data to m4 immediately
// m4 is flowing, so it fires the 'data' event immediately, returns true
// m4's write returned true, so m3 is still flowing, returns true
// m3's write returned true, so m2 is still flowing, returns true
// m2's write returned true, so m1 is still flowing, returns true
// No event deferrals or buffering along the way!
m1.write(Buffer.alloc(2048)) // returns true
```
--------------------------------
### Node.js PassThrough Streams Buffering Example
Source: https://github.com/ghuntley/amazon-kiro.kiro-agent-source-code-analysis/blob/main/node_modules/sqlite3/node_modules/minipass/README.md
Demonstrates how Node.js PassThrough streams buffer data when backpressure is applied, leading to deferred writes and multiple event deferrals. It illustrates the impact of highWaterMark on perceived buffering and the resulting event chain.
```js
const { PassThrough } = require('stream')
const p1 = new PassThrough({ highWaterMark: 1024 })
const p2 = new PassThrough({ highWaterMark: 1024 })
const p3 = new PassThrough({ highWaterMark: 1024 })
const p4 = new PassThrough({ highWaterMark: 1024 })
p1.pipe(p2).pipe(p3).pipe(p4)
p4.on('data', () => console.log('made it through'))
// this returns false and buffers, then writes to p2 on next tick (1)
// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2)
// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3)
// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain'
// on next tick (4)
// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and
// 'drain' on next tick (5)
// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6)
// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next
// tick (7)
p1.write(Buffer.alloc(2048)) // returns false
```